SQL>
SQL> -- Reversing the loop.
SQL> DECLARE
2 loop_start Integer := 1;
3 BEGIN
4 FOR i IN REVERSE loop_start..5 LOOP
5 DBMS_OUTPUT.PUT_LINE('Loop counter is ' || i);
6 END LOOP;
7 END;
8 /
Loop counter is 5
Loop counter is 4
Loop counter is 3
Loop counter is 2
Loop counter is 1
PL/SQL procedure successfully completed.
SQL>
|