大家帮忙看看,这段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'
在PLSQL中执行没问题,在JDBC中查询报列名无效
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答
- a_jian 2013-12-17 02:27关注
问题可以说清楚点:错误日志? 有无用到Hibernet等框架?什么环境?
用排除法来解决错误吧
1.select ```````` 这些字段可以一部份一部份来查,直到找到不能识别的列PS:to_char(T_c_p_i.BIRTHDAY, 'yyyy/mm/dd') 要给别名
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 用三极管设计—个共射极放大电路
- ¥15 请完成下列相关问题!
- ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
- ¥15 求daily translation(DT)偏差订正方法的代码
- ¥15 js调用html页面需要隐藏某个按钮
- ¥15 ads仿真结果在圆图上是怎么读数的
- ¥20 Cotex M3的调试和程序执行方式是什么样的?
- ¥20 java项目连接sqlserver时报ssl相关错误
- ¥15 一道python难题3
- ¥15 牛顿斯科特系数表表示