Sunday, October 3, 2010

Raise Pre-defined exception explicitly

You can raise pre-defined exception explicitly.

SET SERVEROUTPUT ON
DECLARE
       deptno NUMBER(3) := 40;
BEGIN
        IF deptno NOT IN ( 10,20,30 ) THEN
             RAISE INVALID_NUMBER;
        END IF;
EXCEPTION
     WHEN INVALID_NUMBER THEN
         DBMS_OUTPUT.PUT_LINE (' Invalid Deptno supplied');
         ROLLBACK;
END;

No comments:

Post a Comment

External Table

Oracle External Table External tables are defined as tables that do not resides in the database allows you to access data that is stor...