While Loop in PL/SQL

Advertisements

PLSQL Conditional Statement PLSQL Procedure

For While in PL/SQL

Set of instructions given to the compiler to execute set of statements until condition becomes false is called loops. The basic purpose of loop is code repetition that means same code repeated again and again. Here we discuss While loop in PLSQL

A while loop is used when a set of statements has to be executed as long as a condition is true, the While loop is used. The condition is decided at the beginning of each iteration and continues until the condition becomes false.

Syntax

variable initialize

while (condition)
statements;
end loop;

Must be follow below steps;

  • Initialise a variable before the loop body.
  • Increment the variable in the loop body.

While Loop in PLSQL

DECLARE  
i INTEGER := 1;  
BEGIN  
WHILE i <= 10 LOOP  
DBMS_OUTPUT.PUT_LINE(i);  
i := i+1;  
END LOOP;  
END;  

Output

1
2
3
4
5
6
7
8
9
10

PLSQL Conditional Statement PLSQL Procedure

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements