title: Populate an oracle collection type using a SYS_REFCURSOR and close the cursor
body: <p>In my stored procedure, I have a code snippet like this:  </p>
  
  <pre><code>OPEN p_result FOR
  SELECT *
  FROM TABLE (CAST ( l_data AS Rpt_mapping_TableType));
  COMMIT;
  </code></pre>
  
  <p><code>p_result</code> is an <code>IN OUT</code> parameter of type <code>SYS_REFCURSOR</code>.<code>Rpt_mapping_TableType</code> is a user defined collection type.
  So this cursor will just populate the Rpt_mapping_TableType and then the program that calls this proc will read the results from Rpt_mapping_TableType.
  My question is what is the use of <code>COMMIT</code> in this snippet? The code author says it is a way of closing the cursor. Is it right?  My other question is if I just want to populate the collection , do I even need to do <code>OPEN p_result FOR</code>. After all I am not reading anything from the cursor so :</p>
  
  <pre><code>SELECT *  FROM TABLE (CAST ( l_data AS Rpt_mapping_TableType));
  </code></pre>
  
  <p>should suffice.</p>
  
  <p>No?</p>