Hi All,
I have a requirement of converting rows to column level and tried to implement using ListAgg function as shown below along with Regexp_replace to eliminate duplication of values.
But with ListAgg retrieves data , if the record exceeds 4000 characters then report errors out.
Evaluate( 'regexp_replace(LISTAGG(%1,%2) WITHIN GROUP ( ORDER BY (%1) ) OVER ( PARTITION BY (%3) ), ' ' ( [^,]+)(,[ ] *\1)+ ' ' , ' ' \1 ' ' ) ' as Varchar (4000), "Column1", ',' "Column2).
Can any one please suggest and help a workaround to achieve this ?
How can i use XMLAGG function ?
Please help.
Thanks,
LonaD