Skip to content

G-5070: Avoid using Oracle predefined exceptions.

Blocker

Reliability

Reason

You have raised an exception whose name was defined by Oracle. While it is possible that you have a good reason for "using" one of Oracle's predefined exceptions, you should make sure that you would not be better off declaring your own exception and raising that instead.

If you decide to change the exception you are using, you should apply the same consideration to your own exceptions. Specifically, do not "re-use" exceptions. You should define a separate exception for each error condition, rather than use the same exception for different circumstances.

Being as specific as possible with the errors raised will allow developers to check for, and handle, the different kinds of errors the code might produce.

Example (bad)

1
2
3
4
begin
   raise no_data_found;
end;
/

Example (good)

1
2
3
4
5
6
declare
   e_my_exception exception;
begin
   raise e_my_exception;
end;
/