Oracle Trigger Updating a field on an Insert or an Update
oracle, triggers
Solution
CREATE OR REPLACE TRIGGER your_trigger_name
BEFORE INSERT OR UPDATE
ON your_table
FOR EACH ROW
DECLARE
BEGIN
:new.LastUpdated := sysdate;
END;
Try that. I did not have a oracle server at hand, but I hope I got the syntax right.
Problem
For some reason I'm running a blank on how to go about doing something like this. I have a table that looks like this: ``` UserID | Name | DateAdded | LastUpated -------------------------------------------------- 1 | James Q | 1/1/2009 | ``` If I insert or update record the lastupdated field should be updated the sysdate. How would I go about doing something like this?