Tuesday, January 31, 2012

Handling Exceptions Raised in Declarations

SET SERVEROUTPUT ON;

DECLARE
BEGIN
DECLARE
credit_limit CONSTANT NUMBER(3) := 5000; -- raises an exception
BEGIN
NULL;
EXCEPTION
WHEN OTHERS THEN
-- Cannot catch the exception. This handler is never called.
dbms_output.put_line('Can''t handle an exception in a declaration.');
END;
EXCEPTION
WHEN OTHERS THEN
-- Cannot catch the exception. This handler is never called.
dbms_output.put_line('Dont worry I am here.');
END;

No comments:

Post a Comment