Java, JEE, Application Express, GWT, Oracle, Linux, Web Development
Friday, April 27, 2007
Thursday, April 26, 2007
DBMS_UTILITY.FORMAT_ERROR_BACKTRACE
I would hate to think of the number of times I have been faced with an "ORA-01403 - No Data Found" or a "ORA-06502: PL/SQL: numeric or value error: character to number conversion" error and not known where its come from.
In Java/C# you can simply make a call to the printStackTrace() method.In comparison I have always found debugging pl/sql a bit of a black art. I've known of DBMS_UTILITY.FORMAT_ERROR_BACKTRACE for some time but forgot of its existence until recently where I was faced with an exception raise in a pl/sql package but couldn't locate where error originated from.
Example usage is as follows:
When Others Then p_msg_id := 0001; p_msg_type := 'E'; p_msg_text := To_char (Substr (Sqlcode, 1, 20)) || ' : ' || Substr (Sqlerrm, 1, 200) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE;Steven Feuerstein has a very nice article published on OTN and in Oracle Magazine (March/April 05). It can be found at http://www.oracle.com/technology/oramag/oracle/05-mar/o25plsql.html
Labels:
DBMS_UTILITY,
Oracle,
SQL
Subscribe to:
Posts (Atom)