// 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
Error message
PL/SQL: Function returned without value

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 IF or CASE without a branch for every case.
  • An exception handler that logs the error but doesn't return or re-raise.

How to fix it

  1. 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

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.