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: log changes trigger

Re: log changes trigger

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 17 Jan 2001 19:08:55 +0100
Message-ID: <9455vg$c2vst$2@ID-62141.news.dfncis.de>

Just use
uname := user;

Works without problem.

Hth,

Sybrand Bakker, Oracle DBA

"Jonas Malmsten" <deja_at_malmsten.net> wrote in message news:944j73$59h$1_at_nnrp1.deja.com...
> I need to write a trigger to log changes made to a table and by who
> these changes were made. I have created a log table having a field
> user_name varchar2(30) where I intend to store the username for anyone
> who changed the my_table, along with the previous values, before it was
> changed. Currently my trigger looks something like this (I dont need to
> log delete och insert events).
>
> create or replace trigger tr_u_my_table
> after update on my_table
> for each row
> uname varchar2(30);
> begin
> select username into uname
> from v$session where audsid = userenv('SESSIONID');
> insert into my_log
> (username, change_date, other_fields...)
> values
> (uname, sysdate, :old.other_fields...);
> end;
> /
>
> My problem is that not all users have permission to select from
> v$session. Is there another way to do this or do I need to grant select
> on v$session to all_users?
>
> file://Jonas
>
>
>
> Sent via Deja.com
> http://www.deja.com/
Received on Wed Jan 17 2001 - 12:08:55 CST

Original text of this message

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