Loops in Oracle PL SQL
LOOPS in PL/SQL allow us to execute a sequence of statements repeatedly.
Three types of loops are
- Simple Loops
- FOR Loops
- WHILE Loops
Simple Loops
This is the most basic kind of loop.They include LOOP, END LOOP, and some method of EXIT.We use the simple loop when we want the body of the loop to execute at least once.
Read more about Using LOOP in PL SQL
FOR Loop
FOR Loop is the most common looping construct in all programming languages.Using for loop we can define the number of times the loop will cycle before exiting.
Read more about Using FOR Loop in PL SQL
WHILE Loop
We can use WHILE Loop to execute some statements only while a certain condition is met. When it no longer meets the condition, the loop ends.
Every iteration of the loop checks condition to determine if it evaluates
to TRUE. If it does, the action is performed again. If it evaluates to FALSE or NULL,the loop is ended.
Read more about Using WHILE Loop in PL SQL