I am creating a stored procedure to bulk collect the data from one table (table 1) to another table (table 2) using limit clause .
For example if I am loading 80000 records with the limit clause of 1000 how many times the select statement in the sys refcursor gets executed? Is it going to execute once or for each limit's iteration (80000/1000) = 80 times?
Please could someone provide more details on the processing .
code skeleton snippet
create or replace procedure <procedure_name> as
<curosor name> SYS_REFCURSOR;
< collection_name > ;
begin
open <cursor_name> for <select statment>;
loop
fetch <cursor_name> into < collection_name > limit 1000;
exit when <cursor_name>%not_found;
forall i in 1..<collection_name>.count
insert statement into to table 2 values <i>
end loop;