PL/SQL allows you to branch and create loops in a fairly familiar way.
An IF statement looks like:
IF
The ELSE part is optional. If you want a multiway branch, use:
IF
ELSIF
... ...
ELSIF
ELSE ...
END IF;
Loops are created with the following:
LOOP
END LOOP;
At least one of the statements in
EXIT WHEN
The loop breaks if
Some other useful loop-forming statements are:
WHILE
END LOOP;
FOR IN
END LOOP;
Here, can be any variable; it is local to the for-loop and need not be declared. Also,