Build-in Exceptions

Exceptions are used to handle run-time errors in your PL/SQL code. The following table list the common exceptions:

ExceptionErrorDescription
ACCESS_INTO_NULLORA-06530assign values to the attributes of an uninitialized object.
CASE_NOT_FOUNDORA-06592None of the WHEN clauses of a CASE statement was selected, and there is no default ELSE clause.
COLLECTION_IS_NULLORA-06531call an uninitialized collection
CURSOR_ALREADY_OPENORA-06511open an already open cursor.
DUP_VAL_ON_INDEXORA-00001store duplicate values in a column with a unique index.
INVALID_CURSORORA-01001perform an illegal cursor operation, such as closing an unopened cursor.
INVALID_NUMBERORA-01722convert a character string into a number failed
LOGIN_DENIEDORA-01017connect to a database using an invalid user name or password.
NO_DATA_FOUNDORA-01403A SELECT INTO statement returned no rows.
NOT_LOGGED_ONORA-01012access a database item without being connected to the database.
PROGRAM_ERRORORA-06501PL/SQL had an internal problem.
ROWTYPE_MISMATCHORA-06504The cursor variable have incompatible return types.
SELF_IS_NULLORA-30625call a MEMBER method on a null object.
STORAGE_ERRORORA-06500The PL/SQL module ran out of memory.
SUBSCRIPT_BEYOND_COUNTORA-06533reference a nested table or varray element using an out-of-bound index number.
SUBSCRIPT_OUTSIDE_LIMITORA-06532an index number outside the legal range.
SYS_INVALID_ROWIDORA-01410The conversion from a character string to a rowid failed.
TIMEOUT_ON_RESOURCEORA-00051A timeout occurred.
TOO_MANY_ROWSORA-01422A SELECT INTO statement returned more than one row.
VALUE_ERRORORA-06502An arithmetic, conversion, truncation, or size-constraint error occurred.
ZERO_DIVIDEORA-01476An attempt was made to divide a number by zero.

Reference:Oracle 11g SQL by Jason Price


SQL> BEGIN
  2      DBMS_OUTPUT.PUT_LINE('v_width = ' || 2/0);
  3  EXCEPTION
  4      WHEN ZERO_DIVIDE THEN
  5          DBMS_OUTPUT.PUT_LINE('Division by zero');
  6  END;
  7  /
Division by zero

PL/SQL procedure successfully completed.

SQL>
Home »
Oracle »
PL/SQL » 

Exceptions:
  1. Build-in Exceptions
  2. ZERO_DIVIDE Exception
  3. DUP_VAL_ON_INDEX Exception
  4. INVALID_NUMBER Exception
  5. OTHERS Exception
Related: