declare cursor c_cur is select id from sometable; -- type t_cur is table of c_cur%rowtype index by binary_integer; a_cur t_cur; l_limit binary_integer := 1000; begin -- open c_cur; -- loop fetch c_cur bulk collect into a_cur limit l_limit; exit when c_cur%notfound; /*[some code]*/ end loop; -- close c_cur; -- end; declare cursor c_cur is select id from sometable; -- type t_cur is table of c_cur%rowtype index by binary_integer; a_cur t_cur; l_limit binary_integer := 1000; begin -- open c_cur; -- loop fetch c_cur bulk collect into a_cur limit l_limit; exit when a_cur.count = 0; /*[some code]*/ end loop; -- close c_cur; -- end; declare cursor c_cur is select id from sometable; -- type t_cur is table of c_cur%rowtype index by binary_integer; a_cur t_cur; l_limit binary_integer := 1000; begin -- open c_cur; -- loop fetch c_cur bulk collect into a_cur limit l_limit; /*[some code]*/ exit when a_cur.count < l_limit; end loop; -- close c_cur; -- end;