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: A Billington <billiauk_at_yahoo.co.uk>
Date: 21 Jan 2005 01:20:23 -0800
Message-ID: <1106299223.235134.207390@c13g2000cwb.googlegroups.com>


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.

SQL> exec dbms_application_info.set_client_info( 'SOME_PACKAGE' );

PL/SQL procedure successfully completed.

SQL> select sys_context('userenv','client_info') from dual;

SYS_CONTEXT('USERENV','CLIENT_INFO')



SOME_PACKAGE 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.

Regards
Adrian Received on Fri Jan 21 2005 - 03:20:23 CST

Original text of this message

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