Home » SQL & PL/SQL » SQL & PL/SQL » How to find out the user name or login name (Oracle or PL/SQL)
icon8.gif  How to find out the user name or login name [message #406473] Thu, 04 June 2009 03:13 Go to next message
Siva Parvathi
Messages: 1
Registered: June 2009
Junior Member
Hi Gurus,
Please save me from this situation.
I have a problem where I need to find out who logged on to the session and fired any DML command on a table.

I thought of writing a trigger, but could not find any way to retrieve the user name who fired the query on the table.

Please throw some light on this situation.....

Many many thanks in Advance....
Re: How to find out the user name or login name [message #406475 is a reply to message #406473] Thu, 04 June 2009 03:21 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
SELECT USER FROM dual;
Re: How to find out the user name or login name [message #406480 is a reply to message #406473] Thu, 04 June 2009 03:38 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
I assume you are using oracle 10g or above. Check this link.

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions165.htm#sthref2200

Regards

Raj
Re: How to find out the user name or login name [message #406549 is a reply to message #406473] Thu, 04 June 2009 09:54 Go to previous messageGo to next message
scaria.grg
Messages: 3
Registered: May 2009
Location: Kuwait
Junior Member
Hi
You can use this function to get the user name in a trigger:

l_db_user := sys_context('USERENV','SESSION_USER');

regards,
Scaria George.
Re: How to find out the user name or login name [message #406552 is a reply to message #406549] Thu, 04 June 2009 10:27 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is what Raj posted.
Please do not ignore others answer, this is very rude.

Regards
Michel
Re: How to find out the user name or login name [message #406554 is a reply to message #406473] Thu, 04 June 2009 10:32 Go to previous message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
In a 3 tier application, previously posted responses may be inadequate; depending upon exactly "who" is defined to be.
Previous Topic: Find Out Day By Number Of Day
Next Topic: Oracle Trigger Error
Goto Forum:
  


Current Time: Thu Dec 08 18:19:18 CST 2016

Total time taken to generate the page: 0.10668 seconds