Sample Header Ad - 728x90

How to get error code of an exception type without raising it?

1 vote
1 answer
203 views
Is there anyway in Oracle to get the error code associated with a user-defined exception type without that exception being actually raised? I don't want to hard-code the code in the entire pl/sql package, and it should be persistent. example: create package body some_package is item_not_found exception; pragma exception_init(item_not_found , -20010); function do_something is begin -- a select statement -- exception when no_date_found then raise_application_error( [ here I need to pass the error code associated with item_not_found ], 'The item you requested was not found'); end ; end some_package; In this example, sqlerr is not what I need.
Asked by Nina (159 rep)
Feb 20, 2022, 11:34 AM
Last activity: May 19, 2022, 08:56 AM