// Oracle error reference

ORA-01403: no data found

A SELECT INTO in PL/SQL returned no rows, or code read an associative array element that doesn't exist. Handle NO_DATA_FOUND or query in a way that allows zero rows.

Error code
ORA-01403
Category
PL/SQL
Error message
no data found

What it means

In PL/SQL, SELECT ... INTO must return exactly one row. When it returns none, Oracle raises the predefined exception NO_DATA_FOUND (ORA-01403). Reading an element of an associative array that was never assigned raises it too. In plain SQL a query with no rows is not an error.

Common causes

  • A SELECT ... INTO for a key that doesn't exist.
  • A filter that excludes the row, such as a wrong status or date.
  • Reading my_array(i) for an index that was never set.

How to fix it

  1. Handle the case explicitly.

    BEGIN
      SELECT email INTO l_email FROM customers WHERE id = p_id;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        l_email := NULL;
    END;
  2. Or use an aggregate, which always returns one row.

    SELECT MAX(email) INTO l_email FROM customers WHERE id = p_id;
  3. Check my_array.EXISTS(i) before reading an associative array element.

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.