Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: log changes trigger
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
![]() |
![]() |