ORACLE DBMS_UTILITY.format_call_stack 001

ORACLE DBMS_UTILITY.format_call_stack 001

SET SERVEROUTPUT ON
BEGIN
     DBMS_OUTPUT.put_line('A BEGIN');
       BEGIN
            DBMS_OUTPUT.put_line('B BEGIN');
              DECLARE
                     v_CallStack      VARCHAR2(2000);
              BEGIN
                   DBMS_OUTPUT.put_line('C BEGIN');
                   v_CallStack := DBMS_UTILITY.format_call_stack;
                   DBMS_OUTPUT.put_line(v_CallStack);
                   DBMS_OUTPUT.put_line('C END');
              END;
            DBMS_OUTPUT.put_line('B END');
       END;
     DBMS_OUTPUT.put_line('A END');
END;

--DBMS_UTILITY.format_call_stack
SET SERVEROUTPUT ON
DECLARE
       v_CallStack      VARCHAR2(2000);
BEGIN
       DBMS_OUTPUT.put_line('C BEGIN');
       v_CallStack := DBMS_UTILITY.format_call_stack;
       DBMS_OUTPUT.put_line(v_CallStack);
       DBMS_OUTPUT.put_line('C END');
END;
--结果
/*
C BEGIN
----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
135576A4         5  anonymous block

C END
*/


/**
   CREATE OR REPLACE PROCEDURE C AS
        v_CallStack      VARCHAR2(2000);
   BEGIN
        v_CallStack := DBMS_UTILITY.format_call_stack;
   END C;
  
   CREATE OR REPLACE PROCEDURE B AS
   BEGIN
        C;
   END B;
  
   CREATE OR REPLACE PROCEDURE A AS
   BEGIN
        B;
   END A;
 
 
--类似结果
C BEGIN
----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
135576A4         4  PROCEDURE C
135576A4         5  PROCEDURE B
135576A4         5  PROCEDURE A
135576A4         5  anonymous block

C END
*/

你可能感兴趣的:(ORACLE DBMS_UTILITY.format_call_stack 001)