Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Getting Current User from triggers
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 CorpReceived on Mon Jul 16 2001 - 11:34:46 CDT