SQL>
SQL> -- Nesting FOR loops.
SQL> BEGIN
2 FOR i IN 1..2 LOOP
3 FOR j IN 1..4 LOOP
4 DBMS_OUTPUT.PUT_LINE('Outer Loop counter is ' ||
5 i || ' Inner Loop counter is ' || j);
6 END LOOP;
7 END LOOP;
8 END;
9 /
Outer Loop counter is 1 Inner Loop counter is 1
Outer Loop counter is 1 Inner Loop counter is 2
Outer Loop counter is 1 Inner Loop counter is 3
Outer Loop counter is 1 Inner Loop counter is 4
Outer Loop counter is 2 Inner Loop counter is 1
Outer Loop counter is 2 Inner Loop counter is 2
Outer Loop counter is 2 Inner Loop counter is 3
Outer Loop counter is 2 Inner Loop counter is 4
PL/SQL procedure successfully completed.
SQL>
SQL>
|