Tuesday, 25 October 2016

EXIT In Oracle

Exit: 

In Oracle,Exit statement most commonly used to terminate LOOP statements.

Syntax: 

EXIT (when CONDITION);

here when condition is optional.


Example 1:

Loop
v_sal := sal * comm;
exit when v_sal >10000;
End loop;


In this example ,loop would be terminated when v_sal becomes more than 10000.

 Example 2:


LOOP

v_sal := sal * comm;
  IF v_sal >10000 THEN
    EXIT;
  END IF;
END LOOP;

No comments:

Post a Comment