Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Getting Current User from triggers

Re: Getting Current User from triggers

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 16 Jul 2001 09:34:46 -0700
Message-ID: <9iv536025ol@drn.newsguy.com>

In article <9iv0c1$s46$1_at_fe2.cs.interbusiness.it>, "Fabio says...
>
>Hi all !
>I have a trigger attached to a table, that run every time there's an insert
>or an update.
>In this trigger, I need to know the current Oracle User (and other info such
>as those I can get from v$session view such as OSUSER and MACHINE).
>Is there a way to do this with PL/SQL ?
>Thanx in advance for Your co-operation
>
>--
>Fabio GRANDE
>fabiog_at_NOSPAMfileita.it
>

the USER psuedo column works. As well, you can get the v$session row via:

select * from v$session
where sid = ( select sid from v$mystat where rownum=1 );

you'll need DIRECT access to v_$session and v_$mystat or have your dba setup that above query as a view and grant you DIRECT select on that view.

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Mon Jul 16 2001 - 11:34:46 CDT

Original text of this message

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