Please disable your adblock and script blockers to view this page

Search this blog

Friday, 23 March 2018

PL/SQL Loops , Iterative Statement in PL/SQL


Loops are used to repeat execution of a statement or a set of statements multiple times on base of a condition or expression
EXIT and EXIT-WHEN keywords are used to terminate the loop

EXIT- terminates the loop unconditionally and passes control to the next statement after the loop
EXIT-WHEN- terminates the loop when EXIT-WHEN clause is checked and if returns true then the loop is terminated and control is passed to next statement after the loop

The basic syntax of Loop in PL/SQL is like this

LOOP

Set of statements

END LOOP;



Types of Loops in PL/SQL




There are 3 types of loops in PL/SQL

PL/SQL Basic/Exit Loop- In this loop all statements inside the loop are executed at least once and the loop terminates when exit condition is true ..Read in detail

PL/SQL While Loop- Loop continues while a given condition is true and the condition is tested before iteration of statements ..Read in detail

PL/SQL For Loop- Statements are executed for a defined number of times (between two values of the counter variable) as declared in for loop ..Read in detail

Cheers :) Happy Learning

No comments :

Post a Comment