Check cursor%found with if statement in for loop
SQL> create table myTable( x primary key ) organization index as select 1 from dual;
Table created.
SQL>
SQL> create or replace
2 procedure explicit2 is
3 cursor explicit_cur is select 1 from myTable;
4 dummy number;
5 begin
6 open explicit_cur;
7 for i in 1 .. 500 loop
8 fetch explicit_cur into dummy;
9 if explicit_cur%found then
10 dbms_output.put_line('I worked');
11 end if;
12 end loop;
13 close explicit_cur;
14 end;
15 /
Procedure created.
SQL> show errors
No errors.
SQL>
SQL>
SQL> drop table myTable;
Table dropped.
SQL>
SQL>
Related examples in the same category