SQLERRM
The function sqlerrm(errCode)
returns a string that describes the error whose code is errCode
.
The maximum size of the value returned is 512 bytes.
The following block prints the error message for the SQL code -1045:
begin
dbms_output.put_line(sqlerrm(-1045));
end;
/
ORA-01045: user ... lacks CREATE SESSION privilege; logon denied
sqlerrm
can be called without passing the argument. In this case, sqlerrm
prints the error message that is associated with the value of sqlcode
.
Thus, calling sqlerrm
without argument is only useful in an exception handler.