Syntax for LOOP statement in Oracle PL/SQL

Example of LOOP Statement in Oracle PL/SQL

LOOP statement is executed at least once, we need to specify the EXIT clause to come out from LOOP statement.

Syntax:

LOOP
   <statements>
END LOOP;

Example of LOOP Statements:

SET SERVEROUTPUT ON
DECLARE 
   v_id number(2); 
BEGIN 
   v_id := 1;
   LOOP 
        dbms_output.put_line('id: ' || v_id); 
		v_id := V_id + 1;
		EXIT WHEN v_id > 10;
   END LOOP; 
END; 
/
This entry was posted in Oracle on by .
Unknown's avatar

About SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

Leave a Reply