Greetings,
When re-raising an exception, the error stack is lost.
I am using Oracle Database 10g Release 10.1.0.4.0 - 64bit Production on Red Hat Enterprise Linux ES release 4 (Nahant Update 1)
Consider the following code:
SQL> declare
2 L_DUMMY char(1);
3 --
4 procedure P
5 is
6 begin
7 select 'X' into L_DUMMY from DUAL where 1 = 0;
8 end;
9 begin
10 P;
11* end;
12 /
declare
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 7
ORA-06512: at line 10
When I add an exception handler to above code and use "raise" to re-raise the exception, the stack trace is lost, as shown below:
SQL> declare
2 L_DUMMY char(1);
3 --
4 procedure P
5 is
6 begin
7 select 'X' into L_DUMMY from DUAL where 1 = 0;
8 end P;
9 begin
10 P;
11 exception
12 when others then
13 raise;
14 end;
15 /
declare
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 13
Is there some way to keep the stack trace when re-raising an error?
Thanks,
Avi.