dbTalk Databases Forums  

Re: Calling Procedure

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Re: Calling Procedure in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Frank van Bortel
 
Posts: n/a

Default Re: Calling Procedure - 05-25-2005 , 08:41 AM






Björn Wächter wrote:
Quote:
Hi all,
is there a way in oracle to get the name
of the calling procedure?
More SQL Server habits?
The best way is define a variable within the procedure.
You could try to work it out dynamically, see
asktom.oracle.com - search for who_called_me.
Is limited to 3 levels (package->procedure->function),
could be reworked to make it level independent

--
Regards,
Frank van Bortel


Reply With Quote
  #2  
Old   
Mark D Powell
 
Posts: n/a

Default Re: Calling Procedure - 05-25-2005 , 08:45 AM






Check out the following url for code to pull the calling module name
from the stack trace

from http://osi.oracle.com/~tkyte/who_called_me/who.sql

HTH -- Mark D Powell --


Reply With Quote
  #3  
Old   
DA Morgan
 
Posts: n/a

Default Re: Calling Procedure - 05-25-2005 , 09:00 AM



Björn Wächter wrote:
Quote:
Hi all,
is there a way in oracle to get the name
of the calling procedure?


Example:


================================================== ========
PROCEDURE Sp_AAAAA
AS
BEGIN

dbms_output.put_line('Called by: ' || ?????????? );

END Sp_AAAAA;

================================================== ========

PROCEDURE Sp_BBBB
AS
BEGIN

Sp_AAAAA;

END Sp_BBBB;

================================================== ========


Output:

Called by: Sp_BBBB



Thanks Björn
Why and in what version?

I'm inclined to agree with Frank that this is just a bad habit
you are trying to bring with you but there is one valid reason
and that is when an exception is raised. If that is the case
you can use:

dbms_utility.format_call_stack
dbms_utility.format_error_backtrace
dbms_utility.format_error_stack

A demo of this functionality can be found at:
http://www.psoug.org
click on Morgan's Library
click on Exception Handling
--
Daniel A. Morgan
Relational theory is not something that is simply a nice-to-have.
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.