title: Oracle string_agg(distinct columnname) does not work in pl/sql, only in sqldeveloper
body: <p>I am trying to get the string_agg function, <a href="http://www.oracle-base.com/dba/miscellaneous/string_agg.sql" rel="nofollow noreferrer">detailed here</a> to work with the distinct keyword.  Sample usage:</p>
  
  <pre><code>select string_agg(distinct a.name), a.id from tbl_a a group by a.id
  </code></pre>
  
  <p>The problem is that this works in sqldeveloper, but when running it in application express in an anonymous pl/sql block, it refuses to accept the distinct keyword and I get an error saying that the distinct is not allowed.  Why would it be doing this?  Is there a simple workaround?  I am using 10.2 and application express 3.2</p>
  
  <p>Edit: to clarify, I am interested in solving this problem, but if there is another string_agg/group_concat function that I can use I am open to any ideas.</p>
  
  <p>Edit: I eventually want to be able to do something like </p>
  
  <pre><code>select string_agg(distinct a.name),string_agg(distinct a.city), a.id from tbl_a a group by a.id
  </code></pre>
  
  <p>and have both string_agg columns be deduped... this is a problem when using a distinct in a subquery as it does not get the distinct values for both columns...</p>