EXIT Statement in Oracle PLSQL

EXIT statement in Oracle PLSQL is most commonly used to end the LOOP statement’s execution.

The Syntax for the EXIT Statement in Oracle PLSQL is:

EXIT [WHEN boolean_condition];

Example of an EXIT Statement in Oracle PLSQL is:

LOOP
{
  sum := sum + 1;
  EXIT WHEN sum = 35;
}
END LOOP;

The above loop will execute the “sum := sum+1; statement 35 times. The loop will start counting from 1 and as soon as the value of the “sum” variable crosses 35 the loop will terminate.


Tagged , , , , , , , , , , , . Bookmark the permalink.