SQLERRM function in Oracle

SQLERRM function is used within the Exception Handling section of a code. It is used to get the error message. Here, the error message is associated with the most recently raised error exception.

Syntax:

SQLERRM

Example:

EXCEPTION
WHEN OTHERS THEN
Raise_application_error (-20001, 'Error detected - '||SQLCODE||' -ERROR- '||SQLERRM);
END;