CLOB to varchar2 conversion in oracle

倖福魔咒の 提交于 2019-12-11 03:25:33

问题


I need to get the result of the below query in varchar2 to display in a view. I tried using dbms_lob.substr as below but then it gives me error "ORA-22922: nonexistent LOB value".

dbms_lob.substr((select wm_concat(tr_country) from NEXUS_TRAC_TRAVEL_PLAN_DTL where nexus_year = trdata.nexus_year and nexus_seq_no = trdata.nexus_seq_no),4000,1) ,

The select query is returning result in CLOB.


回答1:


WM_CONCAT returns a VARCHAR2, not a CLOB. So you can remove the call to DBMS_LOB.SUBSTR.




回答2:


If you can upgrade to 11.2 or higher the listagg(...) function may save your day as described here: https://stackoverflow.com/a/39325808/1915920



来源:https://stackoverflow.com/questions/12969274/clob-to-varchar2-conversion-in-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!