Searching for "raised."

Q:

Explain how PL/SQL exceptions are raised.

Answer

PL/SQL exceptions are raised using the RAISE command. This command is used when exceptions are defined by programmer and not implicit exceptions.


 


Example:


Declare and raising an exception:


DECLARE


short_of_attendance EXCEPTION;


min_attendance NUMBER(4);


BEGIN


...


IF min_attendance < 10 THEN


RAISE short_of_attendance;


END IF;


EXCEPTION


WHEN short_of_attendance THEN


-- handle the error


END;

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle