Predefined Exceptions
ExplanationOracle Fusion / EBS · Technical · PL/SQLHigh confidenceGenerated
Oracle pre-declares names for common ORA- errors so you can catch them without knowing the error number.
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
GroundingGenerated
Model-generated, grounded against the curated knowledge layer. Check specifics against your instance.