title: Oracle : Combine unique row values into comma-separated string
body: <p>I have a query that returns data like below, need to combine the value column into comma-separated string excluding duplicates and null values.</p>
  
  <pre><code>g_name    g_id      v_data    
  -----     ----      ------
  Test      123        ABC
  Test      123        ABC
  Test      123        DEG
  Test      123        None
  Test      123        
  Test      123        HIJ
  </code></pre>
  
  <p>Desired output :</p>
  
  <pre><code>g_name    g_id      v_data    
  -----     ----      ------
  Test      123        ABC,DEG,HIJ
  </code></pre>
  
  <p>I have tried using <code>XMLAGG</code> but can't remove duplicates and null values.</p>
  
  <pre><code>select g_name,
       g_id,
       RTRIM(XMLAGG(XMLELEMENT(e, v_data || ',')).EXTRACT('//text()'), ',')
  from tblData
  group by g_name, g_id
  </code></pre>