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!