The built-in Oracle functions sqlcode and sqlerrm are especially used in the others processor to return the Oracle error code and error messages respectively.
The others processor should be the final exception processor in the exception processing block because it is used to capture all Oracle exceptions except for Exception Processing by other exception processors, so using an others processor at the outermost layer of the program ensures that all errors are detected.
In an internal exception, sqlcode returns the Oracle error serial number, while sqlerrm returns the corresponding error message. The error message first displays the error code. Sqlcode returns a negative number, unless the Oracle error is "ORA-01403: No data found" (translated: ORA-01403: No data found), when the Oracle error is "ORA-01403: No data found, the corresponding sqlcode is + 100. For user-defined exceptions, sqlcode returns + 1, while sqlerrm returns user-defined exception.
An Oracle error message can contain up to 512 bytes of error code. If no exception is triggered, sqlcode returns 0, sqlerrm returns "ORA-0000: Normal, successful completion ".