Quick Search:
 
 The Oracle PL/SQL EXIT Statement      [Return To Index] Jump to:  

Term: EXIT

Definition:
The Oracle PL/SQL EXIT statement is used to skip the current block. It can be used to terminate loops or stop processing based on a condition you specify. When encountered, an EXIT statement forces a loop to complete immediately and unconditionally. Control is then passed to the next statement (if any).

Example Syntax:

EXIT [ condition ];


The condition can be an expression or a value. For example:

EXIT WHEN core_temperature > 100;

Or
EXIT WHEN total_distance = (25/5);



Example Usage:

The statement below OPENs a cursor C, iterates and fetches the result set, EXITs when the result set is not found, and then closes the cursor.

OPEN C;
LOOP
FETCH
C INTO L_VAR1, L_VAR2;
EXIT WHEN C%NOTFOUND;
---
---
END LOOP;
CLOSE C;


Related Links:
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org