User-Defined Exceptions
Oracle Fusion / EBS · Technical · PL/SQL
GeneralHigh confidence
Declare a custom-named exception, RAISE it for your own business rule, and catch it like any other.
Grounded in: Curated Oracle knowledge layer — PL/SQL
How it works
Declare a custom exception by name in the DECLARE section (of type EXCEPTION), RAISE it explicitly wherever a business rule is violated, and catch it in a WHEN clause exactly like a predefined exception. This is how application-specific error conditions — ones with no corresponding ORA- error of their own — get signaled cleanly.
How it works
DECLARE
insufficient_funds EXCEPTION;
v_balance NUMBER := 100;
v_withdrawal NUMBER := 500;
BEGIN
IF v_withdrawal > v_balance THEN
RAISE insufficient_funds;
END IF;
EXCEPTION
WHEN insufficient_funds THEN
DBMS_OUTPUT.PUT_LINE('Withdrawal exceeds available balance.');
END;
/Related Questions
Have a follow-up, or a different question?
Continue in Ask Oracle AI