Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> log changes trigger
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?
//Jonas
Sent via Deja.com
http://www.deja.com/
Received on Wed Jan 17 2001 - 11:02:34 CST
![]() |
![]() |