oracle 10g中listagg的替代品
Posted
技术标签:
【中文标题】oracle 10g中listagg的替代品【英文标题】:alternative to listagg in oracle 10g 【发布时间】:2019-01-24 13:42:29 【问题描述】:我有这个查询我需要从 oracle 11g 转换到 10g,任何人都可以帮助我完成这个过程,因为在 oracle 10g 中它不支持 listagg
(SELECT REQ.ID_REQUISICAO, 1 AVISO,
LISTAGG(CF.desc_quest || ' Sim. ' || REQ.C_NOTA_QUEST, chr(10))
WITHIN GROUP (ORDER BY 1) ALERTAS
FROM SII_CF_QUEST CF INNER JOIN SII_REQ_QUEST REQ
ON CF.id_quest = REQ.id_quest
WHERE CF.id_aviso IS NOT NULL
AND REQ.id_sn_quest = 1
GROUP BY REQ.ID_REQUISICAO) ;
任何帮助将不胜感激,谢谢
【问题讨论】:
看看这些替代方案:oracle-base.com/articles/misc/string-aggregation-techniques 【参考方案1】:SELECT REQ.ID_REQUISICAO, 1 AVISO, To_Char(wm_concat(CF.desc_quest || ' Sim. ' ||REQ.C_NOTA_QUEST)) AS ALERTAS
FROM SII_CF_QUEST CF INNER JOIN SII_REQ_QUEST REQ
ON CF.id_quest = REQ.id_quest
WHERE CF.id_aviso IS NOT NULL
AND REQ.id_sn_quest = 1
GROUP BY REQ.ID_REQUISICAO ;
解决了我的问题
【讨论】:
你也可以考虑***.com/questions/53558016/oracle-sql-listagg/…作为优雅的sys_connect_by_path
函数的替代品。以上是关于oracle 10g中listagg的替代品的主要内容,如果未能解决你的问题,请参考以下文章
在 Oracle 10g 的 SQL 过程中使用游标的任何替代方法?