-20001: An Oracle Exception Odyssey SQL

 


-- when the keeperrorstack parameter of raise_application_error is set to true,
-- we see the original error that caused the problem
declare
procedure is_difficult_if_trapped_by is
begin
raise_application_error(-20001, 'Debugging this error');
end;
begin
is_difficult_if_trapped_by ();
exception
when others then
raise_application_error(
-20001,
'Unless you keep the error stack by setting this to',
true
);
end;
/

-- when we set it to false, that information is lost,
-- making debugging that bit harder
declare
procedure is_difficult_if_trapped_by is
begin
raise_application_error(-20001, 'Debugging this error');
end;
begin

is_difficult_if_trapped_by ();

exception
when others then
raise_application_error(
-20001,
'Unless you keep the error stack by setting this to',
false
);
end;
/

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)