I have a below SQL and I am trying to convert the LISTAGG to XMLAGG. My DB version is 12.1 and hence LISTAGG is not supporting more than 4K characters.
Original Query :--
SELECT LISTAGG (se1.EMAIL, ', ')
WITHIN GROUP (ORDER BY se1.EMAIL)
AS listofsgs
FROM abc se1, xyz team , mno sne
WHERE team.employee_id = se1.employee_id
AND sne.non_employee_id = team.non_employee_id
Transformed Query :--
SELECT XMLAGG(XMLELEMENT(se1.EMAIL||',')).EXTRACT('//text()')
WITHIN GROUP (ORDER BY se1.EMAIL)
AS listofsgs
FROM abc se1, xyz team , mno sne
WHERE team.employee_id = se1.employee_id
AND sne.non_employee_id = team.non_employee_id
But whenever I run it it keeps failing with Syntax error of missing comma . Is my transformed query correct or am I doing it wrong .
Regards,