title: listagg query result distinct values
body: <p>I have table like this </p>
  
  <pre>+----------------------------+----------------------------+
  | Customer_ref(varchar2(40)) | Event_source-varchar2(40)) |
  +----------------------------+----------------------------+
  | ctx10000012                | 12474748,1247574,1247674   |
  | ctx10000013                | 12474748,12474749,12474750 |
  +----------------------------+----------------------------+</pre>
  
  <pre><code>SELECT LISTAGG(EVENT_SOURCE, ', ') WITHIN GROUP(ORDER BY EVENT_SOURCE) from 
              ( select distinct  customer_ref, EVENT_SOURCE from CUSTEVENTSOURCE where   customer_ref = Acc.Customer_ref AND END_DTM IS NULL) 
  </code></pre>
  
  <p>the output of the table should be like </p>
  
  <pre>+----------------------------+----------------------------+
  | Customer_ref(varchar2(40)) | Event_source-varchar2(40)) |
  +----------------------------+----------------------------+
  | ctx10000012                | 12474748,1247574,1247674   |
  | ctx10000013                | 12474748 - 12474750        |
  +----------------------------+----------------------------+</pre>
  
  <p>How can  i do this, in the single select query (with out using with as table select ()).Because I am using this select query inside the cursor.</p>
  
  <p>your help is appreciated.</p>