1DECLARE
2 i NUMBER;
3BEGIN
4 FOR i IN 1..5
5 LOOP
6 dbms_output.PUT_LINE('i value : ' || i);
7 END LOOP;
8END;
1DECLARE
2 count number(2) := 10;
3BEGIN
4 FOR count in 10..20 (FOR count in REVERSE 10..20)
5 LOOP
6 dbms_output.put_line("COUNT : " || count);
7 END LOOP;
8END;
9
10-- FOR count in 10..20
11-- it will print value from 10 to 20
12-- FOR count in REVERSE 10..20
13-- it will print value from 20 to 10
1-- FOR LOOP --------------
2 FOR loop_counter IN [REVERSE] lowest_number..highest_number
3 LOOP
4 {...statements...}
5 END LOOP;
6
7-- FOR LOOP (MODERN) --------------
8 FOR record_index in cursor_name
9 LOOP
10 {...statements...}
11 END LOOP;
12
13-- CURSOR LOOP (OLD STYLE) --------------
14 OPEN c_customers;
15 LOOP
16 FETCH c_customers into c_rowtype_var;
17 EXIT WHEN c_customers%notfound;
18 {...statements...};
19 END LOOP;