下面提到的游标代码仅适用于Oracle 11g,因为LISTAGG()函数引入了启动版本11g。我需要为Oracle 10g调整此代码。任何帮助将不胜感激。
SELECT DISTINCT (t3.field1), t3.field2,
LISTAGG(t3.field3, ', ') WITHIN GROUP (ORDER BY t3.field3),
SUM(t2.field1), SUM(t2.field2), SUM(t3.field3)
FROM Table1 t1, Table2 t2, Table3 t3
WHERE t1.id = t2.idoft1
AND t2.id = t3.idoft2
GROUP BY t3.field1, t3.field2;