程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> jdbctemmple-在PLSQL中執行沒問題,在JDBC中查詢報列名無效

jdbctemmple-在PLSQL中執行沒問題,在JDBC中查詢報列名無效

編輯:編程綜合問答
在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'

最佳回答:


問題可以說清楚點:錯誤日志? 有無用到Hibernet等框架?什麼環境?

用排除法來解決錯誤吧
1.select ```````` 這些字段可以一部份一部份來查,直到找到不能識別的列

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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved