If you're performing an INSERT/UPDATE/DELETE, be sure to use the explicit transactions.
This vastly reduces the load on your log file by committing per loop, and it prevents huge rollbacks in the case of failure.
Method 1: Temp table with identity column In the first approach, we will use a temp table with an identity column added to allow for row-by-row selection.
Always do this after the insert, since it's faster to add the index in bulk than to update the index as you write into the temp table.
Since you know the data in this column, you can set the fill factor to 100% to get the best read times.
l_start := DBMS_UTILITY.get_time; FOR cur_rec IN (SELECT * FROM bulk_collect_test) LOOP l_tab.extend; l_tab(l_tab.last) := cur_rec; END LOOP; DBMS_OUTPUT.put_line('Regular ('
(DBMS_UTILITY.get_time - l_start)); END; / Regular (42578 rows): 66 Bulk (42578 rows): 4 PL/SQL procedure successfully completed.
The set of rows the cursor holds is called the set.