Oracle pl/sql loop structure
A loop in pl/sql is a repeating control structure that repeats a piece of code.
There are different kinds of loops:
A for loop repeats a code block a specified number of times.
The statement begins with ?for?..?loop? and ends with ?end loop .
for counter in [reverse] lower_bound..higher_bound loop
With lower_bound and higher_bound integer values.
Normal loop in Oracle
A normal loop starts with ?loop? and ends with ?end loop?.
The loop will be stopped when the EXIT statement is reached.
You can also use the RETURN statement to complete pl/sql block before its normal end is reached.
EXIT when ?;
if (condition) then
EXIT outer WHEN condition;
end loop outer;
The while loop statement repeats a code block until a condition is reached.
The statement starts with ?while [condition] loop? and ends with ?end loop?.
while (condition) loop