首页 > 数据库 > Oracle > 正文

oracle wm_concat 字符串缓冲区太小

2024-08-29 13:55:00
字体:
来源:转载
供稿:网友

数据少的时候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


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表