Skip to Main Content
  • Questions
  • How to find out from which procedure the error is emanating....

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Famy.

Asked: March 29, 2002 - 12:01 pm UTC

Last updated: February 25, 2009 - 7:06 am UTC

Version: 8.1.7

Viewed 1000+ times

You Asked

Tom

I have a procedure , which call another procedure , which in turn calls another procedure, and this finally call another procedure. In between these procedures also call functions, which in turn call other functions.

Now when I run my main procedure, how should I figure out...

1.When I encounter an error, how should I know from which procedure or function the error is coming from.
Can you give me an example and show how to code, and what to code, so that I will know exactly where the problem is coming from.

2.Is dbms_trace package useful in any way.

Thank you

and Tom said...

1) the call stack returned to the client tells you this. Just run your procedure in sqlplus and you'll see the entire call stack.

2) did you search for dbms_trace and read the articles on it? do that and you'll see....

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

PLSQL Call Stack

Ananth, December 09, 2008 - 7:50 am UTC

Hi Tom,

Thnanx for the response,
could you pls tell me how to see the "call stack returned to the client"

Regards
Ananth
Tom Kyte
December 09, 2008 - 2:13 pm UTC

it is the ERROR MESSAGE.

just run it in sqlplus, you'll see it. the error message contains this information.

DBMS_TRACE

Ananth, February 25, 2009 - 6:02 am UTC

Hi,

Can you just tell me how to do retreive the more details...

SQL> DECLARE
  2  V_HNCID VARCHAR2(100);
  3  BEGIN
  4  DBMS_TRACE.SET_PLSQL_TRACE(DBMS_TRACE.TRACE_ALL_CALLS);
  5  TEST_FUNCTION();
  6  DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
  7  DBMS_TRACE.CLEAR_PLSQL_TRACE;
  8  END;
  9  /


the output that i got is

----- PL/SQL Call Stack -----
  object      line  object
  handle    number
name
c00000017d608810         6  anonymous block

But i need more details like wat are the calls that test_function made internally..??

i dont have dba access in that schema..?

thnX in advance

Regards
Ananth

Tom Kyte
February 25, 2009 - 7:06 am UTC

dbms_trace writes to sys.plsql_trace_events


you would need access to that to see what trace produced.


You could get what you are seeing without trace:

SQL> DECLARE
2 V_HNCID VARCHAR2(100);
3 BEGIN
6 DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
8 END;
9 /

would produce the output you see already, if you want access to the trace data, you'll need access to that schema object.

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library