How to re-raise pl/sql exception in exception handling block?
exception, oracle, plsql
Solution
If your error stays the same, change to
...
exception when others then
log_error(sqlcode, sqlerrm);
raise;
end;
/
This is explained in the documentation.
Problem
I have the following procedure which is used by some applications: ``` procedure p1 is begin bla bla bla; end; ``` But there is no exception handling block. So applications were written according this feature. Now I need to log errors in p1. But it shouldn't affect applications that use this procedure. Something like this: ``` procedure p1 is begin bla bla bla; exception when others then log_error(sqlcode, sqlerrm); raise_new_exception (sqlcode, sqlerrm); end; ``` In case of raise_application_error first parameter should be in range [-20000, -20999]. So if there raises exception no_data_found, it cannot raise this error. In case of exception_init, second parameter should not be variable. It must be numeric literal. PS: As temporary solution, I'm using execute immediate