Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL dynamically reporting argv[0] in function or procedure
heber.s.pam_at_gmail.com wrote:
> I need pl/sql objects to "dynamically" 'learn' what their object_name
> is. For
> example:
> create or replace function echo_my_name (inStr varchar2) return
> varchar2 IS
> BEGIN
> return 'The function '|| {function_name} ||' received '||inStr||' as
> argv[1]';
> END;
> /
>
> I want to know what it takes for me to replace {function_name} in this
> function
> so that it would return "ECHO_MY_NAME". In c I would be using argv[0],
> but I
> do not know the syntax to do so in PL/SQL. I believe you have the
> capacity,
> because your own error-stack messages often include the offending
> object's name.
>
Oracle knows which procedure the error occurred in by accessing the call stack. The supplied DBMS_UTILITY package contains the FORMAT_CALL_STACK function which may be able to suit your needs:
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_util.htm#sthref9261
HTH,
Brian
-- =================================================================== Brian Peasland dba_at_nospam.peasland.net http://www.peasland.net Remove the "nospam." from the email address to email me. "I can give it to you cheap, quick, and good. Now pick two out of the three" - UnknownReceived on Thu Sep 07 2006 - 20:59:17 CDT
![]() |
![]() |