Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oracle Trigger Problem

Oracle Trigger Problem

From: Eddie Monster <eric.edder_at_oberg.com>
Date: 23 Jul 2003 12:34:24 -0700
Message-ID: <4a20f0a5.0307231134.454bad01@posting.google.com>


I am new to Triggers...

I have two oracle triggers the first trigger (which works fine) simply copies records from table ttdilc501795 to my table (ttdobg501795). The second trigger is an update trigger that is supposed to update only two fields (t$cstk and t$cstr) in my table when they are modified in the original original. The problem is that the trigger updates the fields for all records in my table. How do I fix this?

CREATE OR REPLACE TRIGGER CYCLECOUNT
BEFORE UPDATE ON ttdilc501795
FOR EACH ROW
WHEN (new.t$cstk <> old.t$cstk
OR new.t$cstr <> old.t$cstr)
DECLARE

        ws_cstk number(16,4);
        ws_cstr number(16,4);
BEGIN
        ws_cstk := :new.t$cstk;
        ws_cstr := :new.t$cstr;

UPDATE ttdobg501795
SET t$cstk = ws_cstk,

    t$cstr = ws_cstr
WHERE :new.t$orno = :old.t$orno
AND :new.t$sern = :old.t$sern
AND :new.t$item = :old.t$item;

END; /

Any suggestions would be greatly appreciated! Received on Wed Jul 23 2003 - 14:34:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US