我们使用 Oracle 11g 作为数据库。当我尝试在sqldeveloper上执行select查询时,出现此错误:no more data from socket
。
我的疑问是:
select
first_name,
last_name,
to_char(birth_date,'YYYY') as "date",
state as "ETAT",
null as "number1",
null as "number2",
'R' as "right",
adresse1 as "adresse 1",
adresse2 as "adresse 2",
adresse3 as "adresse 3",
null as "adresse 4",
adresse_cp as "cpostal",
null as "cpostalb",
null as "num_insee",
ville as "ville",
'France' as "pays",
pieces_nb * mobilier as "cont",
null as "field1",
null as "field2",
null as "field3",
null as "field4",
null as "field5",
substr(type,1,1) as "Typ",
null as "field6",
null as "field7",
null as "field8",
null as "field9",
null as "field10",
pieces as "pieces",
null as "piecesb",
null as "surface",
null as "surfaceb",
decode(salaire,'0','P','1','C','2','L','3','L') as "type_salaire",
null as "field11",
decode(residence_id,'0','P','1','S') as "residence",
null as "field12",
null as "Activite",
to_char(sysdate,'DD/MM/YYYY') as "date_fiche",
LEFT OUTER JOIN person ASSIS on (id_person = ident )
LEFT OUTER JOIN address ADDR on (ADDR.ptrsorid = id_adresse and ADDR.adress_id = 'ADDR1**')
LEFT OUTER JOIN address ADDR2 on (ptrfield = id_adresse and adress_id = 'ADDR2')
LEFT OUTER JOIN address ADDR3 on (ptrfield = id_adresse and adress_id = 'ADDR3')
LEFT OUTER JOIN address ADDR on (ptrfield = id_adresse and adress_id = 'ADDR*')
LEFT OUTER JOIN address ADDR4 on (ptrfield= id_adresse and DDE.adress_id = 'ADDR4**')
LEFT OUTER JOIN address ADDR5 on (ptrfield = id_adresse and adress_id = 'ADDR5')
LEFT OUTER JOIN address ADDR6 on (ptrfield = id_adresse and adress_id = 'ADDR6')
LEFT OUTER JOIN address ADDR7 on (ptrfield = id_adresse and adress_id = 'ADDR7')
LEFT OUTER JOIN address ADDR8 on (ptrfield = id_adresse and adress_id = 'ADDR8')
LEFT OUTER JOIN address ADDR9 on (ptrfield = id_adresse and adress_id = 'ADDR9')
LEFT OUTER JOIN address ADDR10 on (ptrfield = id_adresse and adress_id = 'ADDR10')
LEFT OUTER JOIN address ADDR11 on (ptrfield = id_adresse and adress_id = 'ADDR11')
LEFT OUTER JOIN address ADDR12 on (ptrfield = id_adresse and adress_id = 'ADDR12')
LEFT OUTER JOIN address ADDR13 on (ptrfield = ident and adress_id = 'ADDR13')
LEFT OUTER JOIN address ADDR14 on (ptrfield = ident and adress_id = 'ADDR14***')
LEFT OUTER JOIN address ADDR15 on (ptrfield = ident and adress_id = 'ADDR15')
where hab_ptrfield = ident
and ptrpolid = id_person
and person_pass_id = pas_id
and ptr_id_adresse = 0
and pas_adress_id_work = 'OK'
and ADDR9.sousc = 'YS'
and ADDR9.adress_id = 'R'
and adress_id_societe = 'M'
and to_char(pol_datbirth,'YYYYMMDD') < '20161201'
order by person_id;
当我将select查询中的null
值更改为字符串'NULL'并注释to_char(sysdate,'DD/MM/YYYY') as "date_fiche",
时,我得到了预期的结果。
这个错误的解决方案是什么?它与字段的类型有关吗?
答案 0 :(得分:1)
我认为null不应该是问题,但你已经为oracle数据类型日期设置了别名。将其更改为bdate或其他内容。
即
to_char(birth_date,'YYYY') as "bdate",