大家帮忙看看,这段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 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
- ¥15 vscode程序一直报同样的错,如何解决?
- ¥15 关于使用unity中遇到的问题
- ¥15 开放世界如何写线性关卡的用例(类似原神)
- ¥15 关于并联谐振电磁感应加热
- ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
- ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
- ¥66 如何制作支付宝扫码跳转到发红包界面
- ¥15 pnpm 下载element-plus
- ¥15 解决编写PyDracula时遇到的问题