Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get a called procedure/function name within package?

TomeoJan 11 2013 — edited Jan 11 2013
Hi folks,

is it possible to obtain a called procedure/function name within package?

For a measuring and tracing purpose, I would like to store an info at the beginning of each procedure/function in package with timestamp + additional details if needed.

For example:
CREATE OR REPLACE PACKAGE BODY "TEST_PACKAGE" IS
   PROCEDURE proc_1 IS
   BEGIN
      api_log.trace_data(sysdate, 'START.' || ???????);
      
      ...

      api_log.trace_data(sysdate, 'END.' || ???????);
   END;

   PROCEDURE proc_2 IS
   BEGIN
      api_log.trace_data(sysdate, 'START.' || ???????);
      
      ....
      proc_1;
      .... 

      api_log.trace_data(sysdate, 'END.' || ???????);
   END;

    
END; 
I would like to replace "???????" with a function which would return a name of called procedure, so result of trace data after calling TEST_PACKAGE.proc_2 would be:
   11.1.2013 09:00:01    START.*TEST_PACKAGE.proc_2* 
   11.1.2013 09:00:01    START.*TEST_PACKAGE.proc_1*
   11.1.2013 09:00:01    END.*TEST_PACKAGE.proc_1*
   11.1.2013 09:00:01    END.*TEST_PACKAGE.proc_2*
I tried to use "dbms_utility.format_call_stack" but it did not return the name of procedure/function.

Many thanks,
Tomas

PS: I don't want to use an hardcoding

Comments

Timo Hahn
Answer

Isn't this exactly what you told the pivot table to do?

The two records can't be distinguished with the given values of startdate,  hat and sipno.

You can add the starttime to the row edge and you should see the two rows.

Timo

Marked as Answer by Okan Sutcuoglu · Sep 27 2020
Okan Sutcuoglu

Main problem here is i misunderstood pivot table's work principles. Thank you.

1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 8 2013
Added on Jan 11 2013
7 comments
10,308 views