Hi,
oracle version 11.1.0.7
Question1:
I just want to know what is the difference between the methods for using the user defined exceptions.
Method1 : don't need exception initialization
create or replace procedure p1
as
exc_p1 exception;
begin
do something ....
-- fails
Raise exc_p1;
exception when exc_p1 then
raise;
end;
Method 2: using exception initialization
create or replace procedure p2
as
exc_p2 exception;
prgma exception_init(exc_p2,-20999);
begin
p1;
exception
when exc_p2 then
raise;
end;
Question2
Please let me know when and where to use these user defined functions and i read Tom kyte's comments on using when others then Raise or raise_application_error
exception handling. Instead of using raise or raise_application_error can i use "dbms_output.put_line(dbms_utility.format_error_backtrace ); dbms_output.put_line(dbms_utility.format_error_stack))" or can i make the exception handler like below
" when others then
raise_application_error(-20001,'error in p1 '||dbms_utility.format_error_backtrace ||dbms_utility.format_error_stack); "
Thanks,
Mike