PL/SQL For – Loop

FOR … LOOP syntax

FOR counter_variable IN start_value .. end_value
LOOP
--pl/sql statements
END LOOP;

FOR … LOOP example

DECLARE
  i NUMBER:=0;
  start_value NUMBER:=1;
  end_value NUMBER:=5;
BEGIN
DBMS_OUTPUT.PUT_LINE('Start');
	FOR i IN start_value..end_value
	LOOP
		DBMS_OUTPUT.PUT_LINE(' i: ' || i);
	END LOOP;
DBMS_OUTPUT.PUT_LINE('End');
END;

Output

Start
 i: 1
 i: 2
 i: 3
 i: 4 
 i: 5
End