目前我有以下查询:
SELECT
CASE
WHEN ('[Param.3]' = 'SELECTED')
THEN (SELECT RTRIM(XMLELEMENT("Rowset", XMLAGG(RW.R ORDER BY RW."ID")), ' ' ) AS Orders
FROM TMTABLE UL, XMLTABLE('Rowsets/Rowset/Row' PASSING UL.TEXT COLUMNS "ID" NUMBER(19) PATH 'ID', R xmltype path '.') AS RW
WHERE ID BETWEEN '[Param.1]' and '[Param.2]')
WHEN ('[Param.3]' = 'ALL' )
THEN (SELECT RTRIM(XMLELEMENT("Rowset", XMLAGG(RW.R ORDER BY RW."ID")) , ' ' ) AS Orders
FROM TMTABLE UL, XMLTABLE('Rowsets/Rowset/Row' PASSING UL.TEXT COLUMNS "ID" NUMBER(19) PATH 'ID', R xmltype path '.') AS RW)
END AS Orders
FROM
dual
如果使用 XML AGG 将少量 XML 行合并为单行,则此查询工作正常。但如果要合并的 XML 行数较高,则此查询将引发以下错误:
ORA-19011: 字符串缓冲区太小
我需要进行哪些更改才能完成这项工作?