Oracle PL/SQL:Built In Exceptions

PL/SQL has a set of exceptions that are predefined for the common Oracle system errors. Predefined exceptions are used to detect and handle Oracle system errors that occur internally at program run time.
An internal exception is raised implicitly whenever your PL/SQL program violates an Oracle rule or exceeds a system-dependent limit. Every Oracle error has a number, but exceptions must be handled by name. So, PL/SQL predefines some common Oracle errors as exceptions. For example, PL/SQL raises the predefined exception NO_DATA_FOUND if a SELECT INTO statement returns no rows.
You can write handlers for predefined exceptions using the names in the following list:

Exception Raised When Oracle Error
ACCESS_INTO_NULL A program attempts to assign values to the attributes of an uninitialized object. ORA-06530
CASE_NOT_FOUND None of the choices in the WHEN clauses of a CASE statement is selected, and there is no ELSE clause. ORA-06592
COLLECTION_IS_NULL A program attempts to apply collection methods other than EXISTS to an uninitialized nested table or varray, or the program attempts to assign values to the elements of an uninitialized nested table or varray. ORA-06531
CURSOR_ALREADY_OPEN A program attempts to open an already open cursor. A cursor must be closed before it can be reopened. A cursor FOR loop automatically opens the cursor to which it refers, so your program cannot open that cursor inside the loop. ORA-06511
DUP_VAL_ON_INDEX A program attempts to store duplicate values in a database column that is constrained by a unique index. ORA-00001
INVALID_CURSOR A program attempts a cursor operation that is not allowed, such as closing an unopened cursor. ORA-01001
INVALID_NUMBER In a SQL statement, the conversion of a character string into a number fails because the string does not represent a valid number. ORA-01722
LOGIN_DENIED A program attempts to log on to Oracle with an invalid username or password ORA-01017
NO_DATA_FOUND A SELECT INTO statement returns no rows, or your program references a deleted element in a nested table or an uninitialized element in an index-by table. ORA-01403
NOT_LOGGED_ON A program issues a database call without being connected to Oracle. ORA-01012
PROGRAM_ERROR PL/SQL has an internal problem ORA-06501
ROWTYPE_MISMATCH The host cursor variable and PL/SQL cursor variable involved in an assignment have incompatible return types. For example, when an open host cursor variable is passed to a stored subprogram, the return types of the actual and formal parameters must be compatible. ORA-06504
SELF_IS_NULL A program attempts to call a MEMBER method, but the instance of the object type has not been initialized. The built-in parameter SELF points to the object, and is always the first parameter passed to a MEMBER method. ORA-30625
STORAGE_ERROR PL/SQL runs out of memory or memory has been corrupted. ORA-06500
SUBSCRIPT_BEYOND_COUNT A program references a nested table or varray element using an index number larger than the number of elements in the collection. ORA-06533
SUBSCRIPT_OUTSIDE_LIMIT A program references a nested table or varray element using an index number (-1 for example) that is outside the legal range. ORA-06532
SYS_INVALID_ROWID The conversion of a character string into a universal rowid fails because the character string does not represent a valid rowid. ORA-01410
TIMEOUT_ON_RESOURCE A time-out occurs while Oracle is waiting for a resource. ORA-00051
TOO_MANY_ROWS A SELECT INTO statement returns more than one row. ORA-01422
VALUE_ERROR An arithmetic, conversion, truncation, or size-constraint error occurs. ORA-06502
ZERO_DIVIDE A program attempts to divide a number by zero. ORA-01476

No comments

There are still no comments on this article.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:




CAPTCHA Image CAPTCHA Audio
Refresh Image

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .