Eighteen errors are predefined by the Oracle server. As you may have guessed, they are the ones that occur most often in PL/SQL
code. You need not declare them, you can let the Oracle server raise them implicitly for you.
Exception name | Oracle server error number | Description |
ACCESS_INTO_NULL | ORA_06530 | Tried to assign values to the attributes of an uninitialized object |
COLLECTION_IS_NULL | ORA_06531 | Tried to apply collection methods other than EXISTS to an uninitialized nested table or varray |
CURSOR_ALREADY_OPEN | ORA_06511 | Tried to open an already open cursor |
DUP_VAL_ON_INDEX | ORA_00001 | Tried to insert/update a duplicate value in a table with unique index |
INVALID_CURSOR | ORA_01001 | Tried to perform an illegal cursor operation |
INVALID_NUMBER | ORA_01722 | Tried to convert a nonnumeric character to a number |
LOGIN_DENIED | ORA_01017 | Invalid user name or password specified to log in to Oracle |
NO_DATA_FOUND | ORA_01403 | SELECT statement returned no data |
NOT_LOGGED_ON | ORA_01012 | PL/SQL program issued a database call without being connected to Oracle |
PROGRAM_ERROR | ORA_06501 | PL/SQL had an internal problem |
ROWTYPE_MISMATCH | ORA_06504 | Host cursor variable and PL/SQL cursor variable involved in an assignment had incompatible return types |
STORAGE_ERROR | ORA_06500 | PL/SQL ran out of memory or memory was corrupted |
SUBSCRIPT_BEYOND_COUNT | ORA_06533 | Referenced a nested table or varray element using an index number larger than the number of elements in the collection |
SUBCRIPT_OUTSIDE_LIMIT | ORA_06532 | Referenced a nested table or varray element using an index number outside the legal range |
TIMEOUT_ON_RESOURCE | ORA_00051 | Time-out occurred while Oracle was waiting for a resource |
TOO_MANY_ROWS | ORA_01422 | Single-row SELECT returned more than one row |
VALUE_ERROR | ORA_06502 | Arithmetic, conversion, truncation, or size constraint error occurred |
ZERO_DIVIDE | ORA_01476 | Attempted to divide by zero |
Any other standard Oracle server error that is not predefined, falls under this category. You need to declare this within the declarative section and allow the Oracle server to raise these exceptions implicitly. Further, you need to write the exception handler to handle the exception.
This is a condition that the developer determines to be abnormal. You need to declare this within the declarative section and
raise it explicitly using the RAISE
command.
Note: In addition to these exceptions, some application tools with client-side PL/SQL, such as Oracle Developer Forms, have their own exceptions. We will take a detailed look at how to code each of these exceptions in the next few lessons.
In the next lesson, you will learn to handle predefined server exception.
Click the link below to match the different types of predefined server errors with their respective definitions.
Identifying Predefined Server Errors