Sunday, January 11, 2009

Exit Statement

Oracle/PLSQL: Exit Statement


The syntax for the EXIT statement is:

EXIT [WHEN boolean_condition];

The EXIT statement is most commonly used to terminate LOOP statements.

Let's take a look at an example:

LOOP
monthly_value := daily_value * 31;
EXIT WHEN monthly_value > 4000;
END LOOP;

In this example, the LOOP would terminate when the monthly_value exceeded 4000.

No comments:

Post a Comment