IF:
IF condition THEN statements;
[ELSIF condition THEN statements;]
[ELSE statements;]
END IF;
Case expression
appraisal := CASE v_grade
appraisal := CASE
CASE v_mngid
For:
Do not reference the counter as the target of an assignment.
Neither loop bound should be NULL.
FOR counter IN [REVERSE] lower_bound…upper_bound LOOP
statement1; statement2; …
END LOOP;
FOR i IN 3…3 LOOP
statement1;
END LOOP;
Basic loop:
LOOP
statement1;
…
EXIT [WHEN condition];
END LOOP;
WHEN expression1 THEN result1 WHEN expression2 THEN result2 …
WHEN expressionN THEN resultN
[ELSE resultN+1]
END;
/
While:
WHILE condition LOOP (true)
statement1;
statement2;
…
END LOOP;
Nested loop:
You can nest loops to multiple levels.
Use labels to distinguish between blocks and loops. <<outer_loop>>
Exit the outer loop with the EXIT statement that references the label
BEGIN
<<Outer_loop>>
LOOP
v_counter := v_counter+1;
EXIT WHEN v_counter>10;
<<Inner_loop>>
LOOP …
EXIT Outer_loop WHEN total_done = ‘YES’; – Leave both loops
EXIT WHEN inner_done = ‘YES’;
– Leave inner loop only
…
END LOOP Inner_loop;
…
END LOOP Outer_loop;
END;
/
Continue:
-control loop iterations
-filter data inside a loop body before the main processing begins
-transfer control within a loop back to a new iteration or to leave the loop.
– Adds the functionality to begin the next loop iteration
– Provides programmers with the ability to transfer control to the next iteration of a loop
– Uses parallel structure and semantics to the EXITstatement
• Benefits
– Eases the programming process
– May see a small performance improvement over the previous programming workarounds to simulate the CONTINUE statement