Skip to Main Content

Allow to use constants in EXCEPTION_INIT PRAGMAs.

Naeel MaqsudovNov 29 2021 — edited Nov 29 2021

Actually to declare an exception I have do the following:
E_MYEXCEPTION exception;
E_MYEXCEPTION_CODE number := -20101;
PRAGMA EXCEPTION_INIT(E_MYEXCEPTION, -20101);
Because the E_MYEXCEPTION identifier is used to handle the exception and E_MYEXCEPTION_CODE is used to raise it with raise_application_error().
As you can see -20101 is repeated twice. It could be better to use constant in EXCEPTION_INIT pragma in the following way:
E_MYEXCEPTION exception;
E_MYEXCEPTION_CODE number := -20101;
PRAGMA EXCEPTION_INIT(E_MYEXCEPTION, E_MYEXCEPTION_CODE);
But actually impossible

Comments
Post Details
Added on Nov 29 2021
0 comments
18 views