Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect calling database 1

Status
Not open for further replies.

userMikeD

Programmer
Nov 5, 2008
28
US
Is it possible to detect the calling database that accessed a function over a dblink? I have package on a remote database that needs to detect who called it.

For clarity, consider a remote DB we'll call RDB that has package x and a function main.

On a staging DB, I make this call:
v_return := x.main()@RDB;

Back on the remote DB, I need to be able to detect that it came from the staging DB.

I tried to use who_called_me, but was unsuccessful:
Code:
FUNCTION main RETURN VARCHAR2 IS
   v_owner VARCHAR2(50);
   v_name VARCHAR2(50);
   v_line VARCHAR2(50);
   v_caller VARCHAR2(50);
   
BEGIN
   owa_util.who_called_me(v_owner, v_name, v_line, v_caller);
   RETURN v_caller;
END main;

All four variables come back null. So I'm not sure what else to try. Any help is much appreciated!

Thanks,
Mike
 
Hi Mike,
Without changing the arguments in the function, the closest I've come is this

Code:
return sys_context('USERENV','HOST');

That gives me the name of the machine that made the call, which in my case is enough to tell if it was a remote db call.

-----------------------------------------
I cannot be bought. Find leasing information at
 
Hi and thanks for the reply! This is exactly what I needed! I appreciate your help and thanks again!

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top