SQL>
SQL>
SQL> -- unconstrained loop: exit when
SQL>
SQL>
SQL> declare
2 l_loops number := 0;
3 begin
4 dbms_output.put_line('Before my loop');
5
6 loop
7 exit when l_loops > 4;
8 dbms_output.put_line('Looped ' || l_loops || ' times');
9 l_loops := l_loops + 1;
10 end loop;
11
12 dbms_output.put_line('After my loop');
13 end;
14 /
Before my loop
Looped 0 times
Looped 1 times
Looped 2 times
Looped 3 times
Looped 4 times
After my loop
PL/SQL procedure successfully completed.
SQL>
|