1DECLARE
2 n NUMBER(2);
3BEGIN
4 FOR n IN 10 .. 15 LOOP
5 dbms_output.put_line('n= ' || n);
6 END LOOP;
7END;
8
9# When executed the output should be...
10n= 10
11n= 11
12n= 12
13n= 13
14n= 14
15n= 15
16
1/*
2For loop in sql
3*/
4Example:
5DECLARE
6 a number(2);
7BEGIN
8 FOR a in 10 .. 20 LOOP
9 dbms_output.put_line('value of a: ' || a);
10 END LOOP;
11END;
12/
13
14
15Output:
16value of a: 10
17value of a: 11
18value of a: 12
19value of a: 13
20value of a: 14
21value of a: 15
22value of a: 16
23value of a: 17
24value of a: 18
25value of a: 19
26value of a: 20