xuzhiyang12345 2013-12-17 02:01 采纳率: 100%
浏览 3952
已采纳

在PLSQL中执行没问题,在JDBC中查询报列名无效

大家帮忙看看,这段SQL有什么问题,我在PLSQL中执行没问题,但是用JDBC查的时候就报列名无效的错误。
select *
from (select T_c_p_i.HOUSEHOLD_ID,
T_c_p_i.HOUSEHOLD_HEAD_RELATIONSHIP,
T_P_H_A.attribute_meaning as attribute_meaning,
T_c_p_i.PERSON_NAME,
T_c_p_i.GENDER,
to_char(T_c_p_i.BIRTHDAY, 'yyyy/mm/dd'),
T_c_p_i.ID_NUMBER,
T_c_i.COOPERATE_NUMBER,
T_c_i.PERSON_PAYMENT,
T_c_p_i.MARRIAGE_STATE,
T_c_p_i.NATION,
T_c_i.LIVE_TOWN,
T_c_i.LIVE_VILLAGE,
T_c_i.CONTACT_WAY,
T_c_i.CONTACT_ADDRESS,
T_c_p_i.CHRONIC_DISEASE1,
T_c_p_i.CHRONIC_DISEASE2,
T_c_p_i.CHRONIC_DISEASE3,
T_P_H_A.attributeMean as attributeMean,
T_c_i.Area_Id,
T_c_i.Cooperate_Year,
f.hospital_id
from t_cooperate_info T_c_i
left join t_cooperate_person_info T_c_p_i
on T_c_i.person_info_id = T_c_p_i.id
left join (select personInfo.personId,
personInfo.attributeMean,
houseInfo.attribute_meaning
from (select personId,
sys_connect_by_path(attributeMean, ',') attributeMean
from (select temp.person_info_id as personId,
temp.attribute_meaning as attributeMean,
row_number() over(partition by temp.person_info_id order by temp.person_info_id) rn,
count(*) over(partition by temp.person_info_id) cnt
from (select a.person_info_id,
b.attribute_meaning
from t_person_attribute_link a,
t_person_household_attribute b
where a.attribute_id = b.id
and b.id in
(select id
from t_person_household_attribute
where t_person_household_attribute.attribute_type = '01')) temp)
where level = cnt
start with rn = 1
connect by prior personId = personId
and prior rn = rn - 1) personInfo
left join (select a.person_info_id, b.attribute_meaning
from t_person_attribute_link a,
t_person_household_attribute b
where a.attribute_id = b.id
and b.id in
(select id
from t_person_household_attribute
where t_person_household_attribute.attribute_type = '02')
order by a.person_info_id asc) houseInfo
on personInfo.personId = houseInfo.person_info_id) T_P_H_A
on t_p_h_a.personId = T_c_i.Person_Info_Id
left join t_cooperate_info_hospital_link f
on f.cooperate_info_id = T_c_i.Person_Info_Id)
where 1 = 1
and cooperate_year like '%2013%'
and area_id = '1099100700371197000'

  • 写回答

1条回答 默认 最新

  • a_jian 2013-12-17 02:27
    关注

    问题可以说清楚点:错误日志? 有无用到Hibernet等框架?什么环境?

    用排除法来解决错误吧
    1.select ```````` 这些字段可以一部份一部份来查,直到找到不能识别的列

    PS:to_char(T_c_p_i.BIRTHDAY, 'yyyy/mm/dd') 要给别名

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题