The built-in Oracle functions sqlcode and sqlerrm are especially used in the others processor to return Oracle errors respectively. CodeAnd error messages.
Others processor should be the final exception processor in the exception processing block, because it is used to capture all Oracle exceptions except for other exception processor processing, so in ProgramThe outermost layer of the others processor 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: nodatafound, when the Oracle error is ORA-01403: nodatafound, the corresponding sqlcode is 100. For user-defined exceptions, sqlcode returns 1, while sqlerrm returns user-definedexception.
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, successfulcompletion ".