← PL/SQL Topics
Exception Handling
Explain PL/SQL predefined exceptions (NO_DATA_FOUND, TOO_MANY_ROWS, etc.)
Predefined Exceptions
Oracle Fusion / EBS · Technical · PL/SQL
GeneralHigh confidence
Oracle pre-declares names for common ORA- errors so you can catch them without knowing the error number.
Grounded in: Curated Oracle knowledge layer — PL/SQL
How it works
Oracle pre-declares names for the most common ORA- errors so they can be caught without knowing the numeric code: NO_DATA_FOUND (a SELECT INTO matched zero rows), TOO_MANY_ROWS (a SELECT INTO matched more than one), DUP_VAL_ON_INDEX (a unique constraint violation), VALUE_ERROR, ZERO_DIVIDE, and OTHERS as the catch-all for anything not explicitly handled.
How it works
DECLARE
v_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary FROM employees WHERE employee_id = 999999;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No employee with that ID.');
WHEN TOO_MANY_ROWS THEN
DBMS_OUTPUT.PUT_LINE('employee_id should be unique — got multiple rows.');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Unexpected error: ' || SQLERRM);
END;
/Related Questions
Have a follow-up, or a different question?
Continue in Ask Oracle AI