ORA-01489: 字符串连接的结果过长 错误的原因以及解决办
2021-11-19 本文已影响0人
西谷haul
问题
问题语句如下:
select role_cd,listagg(xm.nm,',')within group(order by role_cd)name
from xap_role_menu xrm
left join xap_menu xm
on xrm.menu_cd = xm.menu_cd
where xrm.del_f ='0'
and xm.del_f ='0'
and xrm.role_cd='XAPM14.01'
group by role_cd;
修改后的语句如下:利用xmlagg + xmlparse语法
select role_cd,xmlagg(xmlparse(content xm.nm||',')order by role_cd).getclobval()
from xap_role_menu xrm
left join xap_menu xm
on xrm.menu_cd = xm.menu_cd
where xrm.del_f ='0'
and xm.del_f ='0'
and xrm.role_cd='XAPM14.01'
group by role_cd;