How to create trigger to log inserts/updates on table?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: How to create trigger to log inserts/updates on table?

  1. #1
    Join Date
    Feb 2001
    Location
    Belgium, Sint-Truiden
    Posts
    82

    Question How to create trigger to log inserts/updates on table?

    All,

    as our client 'plays' always with the parameters in the database, we'ld like to have a logging of what they did. The easiest way for me seems a trigger, but I always get the erro ORA-4082: can't use old and new in table trigger.

    CREATE OR REPLACE TRIGGER OMS.configdicttrig
    AFTER INSERT OR UPDATE
    ON configdict
    BEGIN
    insert into configdict_log
    values (ld.CATEGORY ,
    ld.PARAM,
    ld.VALUE ,
    ld.OWNER ,
    configdictseq.nextval);

    insert into configdict_log
    values (:new.CATEGORY ,
    :new.PARAM,
    :new.VALUE ,
    :new.OWNER ,
    configdictseq.nextval);
    commit;
    end;

    Can you help me on how I can log the old line and the new line?

    Thx,

    Rik

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    3,968
    If you want to use :OLD and :NEW you need to specify for each row in the trigger creation command.

  3. #3
    Join Date
    Feb 2001
    Location
    Belgium, Sint-Truiden
    Posts
    82
    Thx Gandolf, works great now...

    Rik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width