This Oracle tutorial explains how to use the Oracle/PLSQL SQLCODE function with syntax and examples.
The SQLCODE function returns the error number associated with the most recently raised error exception. This function should only be used within the Exception Handling section of your code:
The syntax for the SQLCODE function in Oracle/PLSQL is:
There are no parameters or arguments for the SQLCODE function.
Since EXCEPTION HANDLING is usually written with the following syntax:
You could use the SQLCODE function to raise an error as follows:
Or you could log the error to a table using the SQLCODE function as follows: