Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Keeping the stack trace after re-raising

s_mMay 19 2026

Hi!,

Sometimes I find myself using following pattern:

BEGIN 
  -- do stuff that raises exception 
  dbms_output.put_line(1/0); 
EXCEPTION 
  WHEN OTHERS THEN 
  -- cleaning, freeing memory... then re-raise 
    DBMS_LOB.FREETEMPORARY(l_document); 
    RAISE; 
END;

Problem is, the RAISE causes the original line number of the error (3 in this case) to be lost. When calling DBMS_UTILITY.FORMAT_ERROR_BACKTRACE, it points to line 8 (the RAISE statement).

What would be a way around this? I would prefer not to pass error messages around, and I’d also rather avoid adding logging except in the calling procedure. In the ideal case, the error stack would propagate in its entirety.

Thanks for any input!

Comments
Post Details
Added on May 19 2026
2 comments
96 views