This Oracle tutorial explains how to use the Oracle/PLSQL SQLERRM function with syntax and examples.
The SQLERRM function returns the error message 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 SQLERRM function in Oracle/PLSQL is:
There are no parameters or arguments for the SQLERRM function.
Since EXCEPTION HANDLING is usually written with the following syntax:
You could use the SQLERRM function to raise an error as follows:
Or you could log the error to a table using the SQLERRM function as follows: