SQL>
SQL> -- unconstrained loop: exit
SQL>
SQL> declare
2 l_loops number := 0;
3 begin
4 dbms_output.put_line('Before my loop');
5
6 loop
7 if l_loops > 4 then
8 exit;
9 end if;
10 dbms_output.put_line('Looped ' || l_loops || ' times');
11 l_loops := l_loops + 1;
12 end loop;
13
14 dbms_output.put_line('After my loop');
15 end;
16 /
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>
|