title: Convert LISTAGG to XMLAGG Oracle
body: <p>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.</p>
  
  <p>Orignal Query :--</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Transformed Query :-- </p>
  
  <pre><code>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
  </code></pre>
  
  <p>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?</p>