Oracle Listagg Sub query
<pre><code>SELECT e.pem_id          AS id,
     e.pem_subject     AS subject,
     e.pem_content     AS content,
     e.pem_sent_date   AS sentdate,
     e.pem_ref_id      AS referenceid,
     e.pem_from_usr_id AS userid,
     NULL              AS misc,
     (listagg(str.str_us_id, ', ') within GROUP(ORDER BY '') AS attachedusers FROM
      proj_email_usrs eu LEFT OUTER JOIN st_register str ON
      eu.pmu_str_id = str.str_id WHERE eu.pmu_pem_id = '26' GROUP BY '')
FROM   proj_email e
WHERE  e.pem_prj_id = '33'
AND    e.pmu_pem_id = '26'
AND    e.pem_status = 'S';
</code></pre>
<p>It is throwing error as</p>
<blockquote>
<p>ORA-01722: invalid number</p>
<p>01722. 00000 -  &quot;invalid number&quot;</p>
<p>*Cause:    The specified number was invalid.</p>
<p>*Action:   Specify a valid number.</p>
</blockquote>