title: Nested cursor in a cursor
body: <p>I have a cursor which is</p>
  
  <pre><code>CURSOR B_CUR IS select DISTINCT big_id from TEMP_TABLE;
  </code></pre>
  
  <p>This would return multiple values. Earlier it was being used as </p>
  
  <pre><code>FOR b_id IN B_CUR LOOP
      select s.col1, s.col2 INTO var1, var2 from sometable s where s.col3 = b_id.col1;
  END LOOP;
  </code></pre>
  
  <p>Earlier it was certain that the inner select query would always return 1 row. Now this query can return multiple rows. How can I change this logic? </p>
  
  <p>I was thinking to create a nested cursor which will fetch into an array of record type (which i will declare) but I have no idea how nested cursor would work here.</p>
  
  <p>My main concern is efficiency. Since it would be working on millions of records per execution. Could you guys suggest what would be the best approach here? </p>