title: Collecting into VARRAY inside SQL statement
body: <p>I have the following SQL query :</p>
  
  <pre><code>SELECT ID, OC_YEAR FROM ACCOUNTS;
  </code></pre>
  
  <p>This query returns the following resultset:</p>
  
  <pre><code>       ID       |     OC_YEAR          
  ------------------------------------    
         10            2006
         10            2007
         10            2008
         11            2006
         11            2008
  </code></pre>
  
  <p>On the other hand I have a custom type </p>
  
  <pre><code> create TYPE IDS AS VARRAY(10) OF NUMBER(5);
  </code></pre>
  
  <p>And finally I have a function that recieves 2 parameters of type IDS and NUMBER. Is there a way I can collect ID columns into an IDS variable grouping them under the OC_YEAR column and send these two arguments to my function. To make it clearer I need to group the resultset of the above query like this:</p>
  
  <pre><code>(10,11):2006
  (10):2007
  (10,11):2008
  </code></pre>
  
  <p>Not exactly but something similar to GROUP_CONCAT in MySQL. </p>