Clarification on after triggers
Date: 1997/05/07
Message-ID: <863025464.17384_at_dejanews.com>#1/1
Hi!
[Quoted] I would like to do some bookkeeping for some of the tables in the
database. There are two columns in the tables that I use it for:
username and timestamp.
I want the values in these columns to contain the user who inserted or
updated this particular record.
A year ago I got help from tkyte_at_us.oracle.com
> create trigger t_trigger
> before update of T
> for each row
> begin
> :new.username := USER;
> :new.timestamp := SYSDATE;
> end;
> /
>
> To secure this you could do one of a couple of things:
> 1.) turn the above trigger into a "before insert or update", then no
> matter what the user inserts in the username/timestamp columns or
> updates them to be, your trigger will set them to what they should be
> (the user can try as hard as they want to fake out the system but their
> updates will always disappear).
So far as I understand, the author meant "after insert or update".
However, if I try to do this, I get:
ERROR at line 1:
ORA-04084: cannot change trigger NEW values in after row triggers
So, is there a way to write an after trigger that makes sure that the username and the timestamp are current inspite of any user attempts to modify them manually?
Thank you.
k&
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Wed May 07 1997 - 00:00:00 CEST