Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: how can a PL/SQL identify itself?

Re: how can a PL/SQL identify itself?

From: Frank van Bortel <fvanbortel_at_netscape.net>
Date: Fri, 21 Jan 2005 13:16:26 +0100
Message-ID: <csqrog$50p$1@news2.zwoll1.ov.home.nl>


Frank Piron wrote:
> Am 21 Jan 2005 01:20:23 -0800 schrieb A Billington <billiauk_at_yahoo.co.uk>:
>

>> DBMS_APPLICATION_INFO provides SET_CLIENT_INFO and SET_ACTION
>> procedures for you to "register" your package as already stated above.
>> However, you don't need to query anything to get the information back -
>> use SYS_CONTEXT( 'userenv', 'client_info' ) or SYS_CONTEXT( 'userenv',
>> 'action' ) e.g.

>
>
> According to my 9i-Docs and a test 'action' is not a valid userenv
> parameter. Additionally the 'module_name' cannot be retrieved via userenv.
>
>> Although if you have multiple packages executing, then they will be
>> wiping each other out. Far better in this case to use the call stack to
>> get your information - see Tom Kyte's "WHOAMI" function at
>> asktom.oracle.com. It enables a PL/SQL package or procedure to retrieve
>> its top-level name from the call stack.

>
>
> A nice application of DBMS_UTILITY.FORMAT_CALL_STACK().
> Thanks for the ref!
>
> Regards

Be warned; the whoami only works for a set environment (e.g. a package calls a procedure calls a function), nothing more, nothing less. The depth is fixed.
-- 
Regards,
Frank van Bortel
Received on Fri Jan 21 2005 - 06:16:26 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US