DGL Statement Reference : EXIT

EXIT

Description
Exits from the current loop to the statement after the loop construct or to the construct that contains the current loop.
Typically, a condition would be tested in a loop, and the exit would be based upon the evaluation of that condition.
Syntax
EXIT;
Note: EXIT can be used only inside a FOR and WHILE loop.
Example
This example continues the execution of the statements between the LOOP and END LOOP, depending on the value of the condition a > b.
The iterations go on as long as the status st is equal to 0. When st is not equal to stm_success, it causes the iterations to stop. The IF statement here is used to force an abnormal EXIT from within the WHILE loop.
The execution resumes at the next statement after the END LOOP.

WHILE a > b LOOP
md_id := stm_r_md (name, st);
IF st <> stm_success THEN
WRITE (‘Illegal Status’);
EXIT;
END IF;
.
.
END LOOP;

See Also