How to use for loop in Oracle
FOR loop_counter IN [REVERSE] lowest_number..highest_number LOOP {...statements...} END LOOP;
- [REVERSE]: Optional. The loop counter will count in reverse.
If REVERSE is specified, then the highest_number will be the starting value for loop_counter and lowest_number will be the ending value for loop_counter.