{{**Note: Any other relevant example shall be considered. **}}
For Loop :
The FOR LOOP statement specifies a range of integers, then execute a sequence of statements once for each integer in the range.
To reverse the range , “REVERSE” keyword is used.
The syntax is :
FOR i IN lower_bound..upper_bound LOOP <loop_body><loop body/statements>
END LOOP;
OR
For counter IN [reverse] lower_bound..upper_bound LOOP<loop body/statements>;
END LOOP;
Example:
begin
For a in 10..20 loop --output 10 to 20 elements dbms_output.put_line(‘value of a :’ || a);
End Loop;
End;
0 Comments