Forum Stats

  • 3,872,071 Users
  • 2,266,376 Discussions
  • 7,911,043 Comments

Discussions

Trigger Validation Failed

Mikail
Mikail Member Posts: 92
edited Jun 16, 2011 7:56AM in General Database Discussions
Hi,
I want to keep track of changes to one table in another table. What I need is an after update trigger which writes the name of changed column (if multiple columns are changed then there will be multiple inserts to the CHANGES table),the column's old and new values. How do I do that. I tried this but got an error after insert.So I'm giving you just the body.

IF :NEW.STAJYEAR!=:OLD.STAJYEAR THEN
INSERT INTO X_STAJ (USERID,EDITDATE,CHANGEDCOLUMN,OLDVALUE,NEWVALUE)
VALUES (:NEW.USERID,SYSDATE,'STAJYEAR',:OLD.STAJYEAR,:NEW.STAJYEAR);
END IF;
Tagged:

Answers

This discussion has been closed.