inventorycolumn to produce the final result, so that a final value of 63 is
placedinto the database.
28 > 6828 > 23
68 > 63
Conflict
resolution
trigger:
correct
result
Implementingthe
solution Asuitable RESOLVE UPDATEtrigger for this situation would add the
incrementsfrom the two updates. Forexample,
CREATE TRIGGER resolve_quantity
RESOLVE UPDATE OF quantity
ON "DBA".product
REFERENCING OLD AS old_name
NEW AS new_name
REMOTE AS remote_name
FOR EACH ROW
BEGIN
SET new_name.quantity = new_name.quantity
+ old_name.quantity
- remote_name.quantity
END
Thistrigger adds the difference between the old value in the consolidated
database(68) and the old value in the remote database when the original
UPDATEwas executed (28) to the new value being sent, before the
UPDATEis implemented. Thus, new_val.quantity becomes 63 (= 23 + 68 -
28),and this value is entered into the quantity column.
Consistencyis maintained at the remote database as follows:
1. The original remote UPDATE changed the value from 28 to 23.
2. The warehouse’s entry is replicated to the remote database, but fails as
theold value is not what was expected.
3. The changes made by the RESOLVE UPDATEtrigger are replicated to
theremote database.
Reporting conflicts
Insome cases, you may not want to alter the default way in which
126