// Oracle error reference
ORA-06503: PL/SQL: function returned without value
A PL/SQL function reached its end, or an exception handler finished, without executing a RETURN statement.
- Error code
ORA-06503- Category
- PL/SQL
What it means
Every path through a PL/SQL function must end in RETURN value. ORA-06503 means the function ran off its end, typically through an IF branch or an exception handler that has no RETURN.
Common causes
- An
IForCASEwithout a branch for every case. - An exception handler that logs the error but doesn't return or re-raise.
How to fix it
-
Make sure every path returns, including exception handlers.
CREATE OR REPLACE FUNCTION grade (p_score NUMBER) RETURN VARCHAR2 IS BEGIN IF p_score >= 90 THEN RETURN 'A'; ELSIF p_score >= 75 THEN RETURN 'B'; END IF; RETURN 'C'; EXCEPTION WHEN OTHERS THEN RAISE; END;
Related errors
More pl/sql errors
ORA-01422exact fetch returns more than requested rowsORA-06502PL/SQL: numeric or value errorORA-06550PL/SQL compilation error at line, columnORA-06508PL/SQL: could not find program unit being calledORA-04091table is mutating, trigger may not see itORA-04088error during execution of triggerORA-04068existing state of packages has been discarded
The code and message text are from the Oracle Database Error Help. Browse the full Oracle error list or search every database error.
// fewer errors, faster fixes
Work on Oracle in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Oracle and the other databases you use.