Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005

    Unanswered: Update trigger: getting old value and new value


    Im facing some problem with the update trigger,

    I wrote a short script to actually insert a new record in a table
    once a record is updated..

    Lets say i have two tables
    1) Master - OldValue
    2) Slave - OldValue, NewValue

    Master table has 1 column (OldValue)
    Slave table has 2 columns (OldValue,NewValue)

    I want each updated record to be stored in Slave table with OldValue and NewValue

    Below is my script

    L> create or replace trigger testtrigger
    2 before update on master
    3 for each row
    4 begin
    5 insert into slave values (: Old.OldValue);
    6 end testtrigger
    7 /

    The problem is the my script can only get the old value, how do i actually get the new value and store it in a single record in slave table?

    I even tried to use the update after trigger, but returned compilation error

    create or replace trigger testtrigger1
    after update on master
    for each row
    insert into slave values (: old.OldValue,:new.OldValue);
    end testtrigger1

    Any guidance will be appreciated..thanks..
    Last edited by a1jit; 02-15-06 at 06:17.

  2. #2
    Join Date
    Feb 2005
    thanks guys, manage to do it using the following url

Posting Permissions

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