For loop in PL/SQL.

For loop:
It is an iterative type of control statement used to repeat part of a program again and again.
it syntax is:

FOR variable_Name IN RANGE (initial_value....final_value)
LOOP
........block.......
END LOOP;

Example;

SET SERVEROUTPUT ON

DECLARE
    num number(2);

BEGIN
    FOR num IN 1..10 LOOP
    DBMS_OUTPUT.PUT_LINE('NUMBER IS '||num);
    END LOOP;
END;
/

Output:


Comments

Popular posts from this blog

Introduction to Python.

Decision Making Statement.