Saturday, August 4, 2018

Example of DBMS_UTILITY. FORMAT_CALL_STACK (How to get call trace in PLSQL?)











Sometimes, while debugging an undocumented code or analyzing a complex algorithm with multiple packages and calling programs, it’s very helpful if there is a utility to show the entire call trace till the first program which initiated the process. 

For above scenario, Oracle has provided a utility named DBMS_UTILITY.FORMAT_CALL_STACK

In this post, I tried to demonstrate its purpose with simple example. 


Test Procedures:
/*Create the procedure TRY1*/
CREATE OR REPLACE PROCEDURE TRY1
IS
BEGIN
dbms_output.put_line(substr(dbms_utility.format_call_Stack, 1,255));
END;
/

CREATE OR REPLACE PROCEDURE TRY2
IS
BEGIN
/*Call procedure TRY1*/
TRY1;
END;
/

CREATE OR REPLACE PROCEDURE TRY3
IS
BEGIN
/*Call procedure TRY2*/
TRY2;
END;
/

Execution:
 

























  Hope this helps!!





0 Responses to “Example of DBMS_UTILITY. FORMAT_CALL_STACK (How to get call trace in PLSQL?)”

Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.