Co uděláte s tak dlouhým řetězcem?
Každopádně se podívejte na tento příklad; if listagg
nebude fungovat, xmlagg
bude.
SQL> create table test (id, col) as
2 select rownum, a.column_name
3 from user_tab_columns a cross join user_tab_columns b
4 cross join user_tab_columns c;
Table created.
SQL> select count(*) from test;
COUNT(*)
----------
9261
SQL> select listagg(col, ' ') within group (order by null) result from test;
select listagg(col, ' ') within group (order by null) result from test
*
ERROR at line 1:
ORA-01489: result of string concatenation is too long
SQL> select length(xmlagg(xmlelement(e, col, ' ').extract('//text()') order by null).GetClobVal()) length_result
2 from test;
LENGTH_RESULT
-------------
51156
SQL>