When An insert or delete happens on table A,
-> if A.Field 1 is avalable in Table "B",
--> check if A.Field 2 is available in Table "C".. If INSERT, insert it into table "C" .. if "DELETE", delete it from table "C".
Can we accomplish this with DB2 triggers? I'm poor in this..
COMP LOC-ID DESC FILED 3 FIELD 4 ...
A100 9991221 TEST1 X X
A100 9991223 TEST1 X X
A101 8991221 TEST1 X X
A101 8991222 TEST1 X X
COMP LOCID FILED 5 FIELD 6
A100 9991221 X X
A100 9991222 X X
A101 8991221 X X
A101 8991222 X X
COMP code and LOCID in Table C should be available in Table "A"..
There is no problem when we do an initial load.. but in the future, if a LOCID is inserted or deleted from Table "A",
if COMP associated with LOCID inserted or deleted is in Table "B", then we have to insert/delete that into Table "C" (getting data for Field5 and Field 6 from other tables).. if COMP associated with LOCID inserted or deleted is not in Table "B".. we can just ignore it..
I wanted to check if it is possible to do this thru Triggers.. as we dont want to go for a new program and schedule another job..