User-defined execption with custom message
Want to define a custom message for a user defined exception. What I have now: declare e exception; pragma exception_init (e, -20100); begin raise e; end; ORA-20100: ORA-06512: at line 5 What I want: exec dbms_output.put_line(userenv('COMMITSCN')) ORA-01725: USERENV('COMMITSCN') not allowed here ORA-06512: at "SYS.STANDARD", line 202 ORA-06512: at line 1 at "SYS.STANDARD", line 202 we can see: raise USERENV_COMMITSCN_ERROR; The exception is defined in specification as: -- Added for USERENV enhancement, bug 1622213. USERENV_COMMITSCN_ERROR exception; pragma EXCEPTION_INIT(USERENV_COMMITSCN