Forum Stats

  • 3,782,142 Users
  • 2,254,605 Discussions
  • 7,879,941 Comments

Discussions

Allow to use constants in EXCEPTION_INIT PRAGMAs.

Naeel Maqsudov
Naeel Maqsudov Member Posts: 3 Red Ribbon
edited Nov 29, 2021 7:54PM in Database Ideas - Ideas

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

Naeel Maqsudovuser11970842Niels Hecker
3 votes

Active · Last Updated