SQL>
SQL> create table t ( x varchar2(5) );
Table created.
SQL>
SQL> declare
2 type rc is ref cursor;
3 l_cursor rc;
4 begin
5 for i in 1 .. 5000
6 loop
7 open l_cursor for 'select x from t where x = ' || to_char(i);
8 close l_cursor;
9 end loop;
10 end;
11 /
PL/SQL procedure successfully completed.
SQL>
SQL> declare
2 type rc is ref cursor;
3 l_cursor rc;
4 begin
5 for i in 1 .. 5000
6 loop
7 open l_cursor for 'select x from t where x = :x' using i;
8 close l_cursor;
9 end loop;
10 end;
11 /
PL/SQL procedure successfully completed.
SQL>
SQL> drop table t;
Table dropped.
SQL>