title: How to resolve "ORA-00939: too many arguments for function " error?
body: <p>I have the following query:
  Firstly I have created a type:</p>
  
  <pre><code>CREATE OR REPLACE TYPE array_id IS VARRAY(50000) OF VARCHAR2(50);
  </code></pre>
  
  <p>I am executing the below query:</p>
  
  <pre><code>SELECT B.ID,
         LISTAGG (A.NAME,', ') WITHIN GROUP (ORDER BY A.NAME),
         Assignednames,
         B.IsManager
  FROM LOCATION A
  INNER JOIN EMPLOYEES B
      ON A.LOCATIONID = B.LOCATIONID
  WHERE B.ID IN (SELECT * FROM table(array_id('244410','PERF507' )) )
  GROUP BY B.ID,
           B.IsManager 
  </code></pre>
  
  <p>Now, when I am executing the abovequery, it's working fine when the number of elements inside array_id('244410','PERF507') is less.But in real environment I have around 15K records; and its giving the below error:</p>
  
  <pre><code>ORA-00939: too many arguments for function
  </code></pre>
  
  <p>Now, I tried changing the type:
  CREATE OR REPLACE TYPE array_id IS VARRAY(50000) OF VARCHAR2(50);
  to CREATE OR REPLACE TYPE array_id IS VARRAY(500000) OF VARCHAR2(20); and other combinations but still getting the same error.</p>
  
  <p>I am sure its due to the sizing, but not able to get the correct calculations!
  Any help will be highly appreciated.
  Thanks in advance.</p>