Sample Header Ad - 728x90

Oracle: Is there a way to put exception handling into a function and just reference that function inside procedures?

0 votes
1 answer
443 views
If you were going to write 10 procedures that all have the same exceptions, you'd want to just reference the procedures defined somewhere else, right? You can call a function inside a procedure
create or replace procedure P
    a_variable_name number;
begin
    a_variable := a_function('a parameter');
end;
/
And i imagine you'd have to pass the result of your procedure into the function. Like
if X procedure executed correctly, then do nothing
if Y error, do the Y exception handling
Is such a thing possible? If not, how do oracle users handle writing 10 different procedures that all use the same exception handling? Like, are there any tips and tricks besides just copying and pasting those exceptions and hoping you'll never have to change all 10 of them if you have to change one thing?
Asked by ellie-lumen (271 rep)
Aug 18, 2020, 09:57 PM
Last activity: Apr 19, 2025, 02:07 PM