Synchronize column with max from another table
I would like to synchronize column last_corr_date from table A with the max value of table NEGOTIATION per emp_code and app_counter
Tables
A NEGOTIATION
----------------------------------- -----------------------------------
emp_code number emp_code number
app_counter number app_counter number
last_corr_date date entered_date date
CREATE OR REPLACE TRIGGER TRIG_1 BEFORE
INSERT
OR UPDATE
OR DELETE OF "ENTERED_DATE" ON "NEGOTIATION" REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW BEGIN
update a
set last_corr_date=(select max(negotiation.entered_date) from negotiation where negotiation.emp_code=:old.emp_code and negotiation.app_counter=:old.app_counter)