SQL> set serverout on;
SQL> -- while loop
SQL>
SQL> declare
2 loops number := 0;
3 begin
4 dbms_output.put_line('Before my loop');
5
6 while loops < 5 loop
7 dbms_output.put_line('Looped ' || loops || ' times');
8 loops := loops + 1;
9 end loop;
10
11 dbms_output.put_line('After my loop');
12 end;
13 /
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>
|