数据少的时候wm_concat(字段名)可以正常拼接出字符串,数据多的时候就会报错(如图片所示)
原sql语句是:
select t2.districtname, t.diagnosis_name, t3.cn, t3.names from T_DISEASE_DIAGNOSIS t inner join t_sys_district t2 on t.district_id = t2.districtid inner join (select t2.diagnosis_name, count(*) cn, wm_concat(t.personnel_name) names from t_exam t inner join t_exam_disease t2 on t.exam_code = t2.exam_code inner join t_disease_diagnosis t30 on t2.diagnosis_name = t30.diagnosis_name where t.RECORD_STATUS = 'Normal' group by t2.diagnosis_name) t3 on t.diagnosis_name = t3.diagnosis_name order by t2.districtorder, t.diagnosis_order 修改后的sql语句是:
select t2.districtname, t.diagnosis_name, t3.cn, t3.names from T_DISEASE_DIAGNOSIS t inner join t_sys_district t2 on t.district_id = t2.districtid inner join (select t2.diagnosis_name, count(*) cn, RTRIM(xmlAGG(XMLPARSE(CONTENT personnel_name || ',' WELLFORMED)) .GETCLOBVAL(), ',') names from t_exam t inner join t_exam_disease t2 on t.exam_code = t2.exam_code inner join t_disease_diagnosis t30 on t2.diagnosis_name = t30.diagnosis_name where t.RECORD_STATUS = 'Normal' group by t2.diagnosis_name) t3 on t.diagnosis_name = t3.diagnosis_name order by t2.districtorder, t.diagnosis_order
新闻热点
疑难解答