Oracle has a large set of predefined exceptions.
A few of the most common predefined exceptions are named such as ZERO_DIVIDE.
All named exceptions have codes.
In the exception-handling block, you will usually refer to them by using their more user-friendly names.
A few of the most important ones are mentioned here:
Name | Number | Description |
---|---|---|
INVALID_NUMBER | ORA-01722 | Conversion of string to number failed. |
VALUE_ERROR | ORA-06502 | Generic error indicating that there is an inconsistency between the variable and its value. |
DUP_VAL_ON_INDEX | ORA-00001 | attempting to store duplicate values in a database column that is constrained by a unique index. |
If the exception is unnamed, to handle the exception use the SQLCODE function.