Search This Blog

Thursday, February 14, 2013

Using $$PLSQL_LINE and $$PLSQL_UNIT to find out exact line of Error and Program Unit

Sample Code to use $$PLSQL_LINE and $$PLSQL_UNIT for debugging.
It will provide the exact line of error and the Program Unit.


CREATE OR REPLACE PROCEDURE XX_TEST_DEBUG AS
  v_debug_line PLS_INTEGER := $$PLSQL_LINE;
  v_debug_proc VARCHAR2(240)  := $$PLSQL_UNIT;
  v_po_num VARCHAR2(240);
BEGIN
SELECT SEGMENT1  INTO v_po_num FROM PO_HEADERS_ALL;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM || v_debug_line ||'-'|| v_debug_proc);
END;

No comments:

Post a Comment