在Oracle 10g中替代listagg

时间:2019-01-24 13:42:29

标签: sql oracle oracle11g oracle10g

我有这个查询,我需要从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) ;

任何帮助将不胜感激,谢谢

1 个答案:

答案 0 :(得分: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 ;

解决了我的问题