title: BULK COLLECT into table of objects inside LOOP?
body: <p>This is what i have done untill now. I created this object and table of objects.</p>
  
  <pre><code>CREATE TYPE my_obj as object(
     val1      varchar2(30),
     val2     varchar2(30),
     val3      varchar2(30));
  
  create TYPE table_obj IS TABLE OF my_obj;
  </code></pre>
  
  <p>Inside my procedure i do this:</p>
  
  <pre><code>PROCEDURE MYPROC(
      TABLEOBJ                          OUT     table_obj, 
      MYCURSOR                          OUT     OTHERPCK.REFCURSOR,
      ...other IN param)
  AS
  
  --other code
  </code></pre>
  
  <p>Inside a LOOP i need to do a query and it gives three varchar2 values as output on each iteration (i.e. val1, val2, val3) and i need to store them in TABLEOBJ and after query this table to put all of the results on my ref cursor, so:</p>
  
  <pre><code> BEGIN    
   FOR SOMETHING IN SOMETHINGELSE LOOP
  
   SELECT my_obj(VAL1, VAL2, VAL3) BULK COLLECT INTO TABLEOBJ
   FROM ...
   WHERE ...
   ENDLOOP;
  
   OPEN MYCURSOR FOR SELECT * FROM TABLE(TABLEOBJ);
  </code></pre>
  
  <p>The code compiles without problems but i get only one row in MYCURSOR and surely there are more than one. I have tried also:</p>
  
  <pre><code>SELECT VAL1, VAL2, VAL3 INTO TABLEOBJ
  </code></pre>
  
  <p>But i get:</p>
  
  <pre><code>PL/SQL: ORA-00947: not enough values
  </code></pre>
  
  <p>How can i put each result of the select (always one row of these three varchar2) and save it to TABLEOBJ?</p>