title: Fetch and bulk collect from a REF CURSOR returned by a procedure
body: <p>I have a stored procedure that has a <code>SYS_REFCURSOR</code> as an <code>OUT</code> parameter. The signature is, for example, as follows:</p>
  
  <pre><code>PROCEDURE myProc(p_someID IN INTEGER, p_cursor OUT SYS_REFCURSOR);
  </code></pre>
  
  <p>I call this procedure from a function, where I have to copy a column named <code>clientID</code> from the <code>p_cursor</code> to a scalar nested table.</p>
  
  <p>I am doing as follows:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION myFunction
      RETURN sys_refcursor
  IS
      someID      INTEGER       := 1234;
      myCursor    SYS_REFCURSOR;
      TYPE t_clientID_nt IS TABLE OF NUMBER(16,0);
      clientID_nt t_clientID_nt;
      otherID     SYS_REFCURSOR;
  BEGIN
      myProc (someID, myCursor);
      FOR i IN myCursor
      LOOP
          clientID_nt.EXTEND;
          clientID_nt (clientID_nt.COUNT) := i.clientID;
      END LOOP;
  
  
      -- Other code that opens the cursor otherID
      -- based on the IDs in clientID_nt
      ...
      ... 
      RETURN otherID;
  END;
  /
  </code></pre>
  
  <p>When I try to compile this function, the error I get is:</p>
  
  <pre><code>PLS-00221: 'CLIENTID_NT' is not a procedure or is undefined
  </code></pre>
  
  <p>and it is at line 11 of the code.</p>
  
  <p>Any help on how to fetch and bulk collect from such a cursor is greatly appreciated.</p>