I have a first procedure like this
procedure p1(a in varchar2)
is
begin
-- call second procedure
p2(a);
-- other things
end;
My second procedure may have an exception to raise:
procedure p2(a in varchar2)
is
lv varchar2(20);
begin
select '1' into lv from dual;
if lv = '2' then
raise general_exception;
end if;
end;
My general_exception variable is a global exceptions type, inside the package where both of my procedures are in.
I want to catch the exception in the first procedure p1 to avoid the execution of the other things.
I've tried this, but with no results:
procedure p1(a in varchar2)
is
begin
-- call second procedure
p2(a);
-- other things
exception when general_exception then
dbms_output.put_line('ERROR');
end;