I need this trigger to be executed when there is an update in the auction
table, but only when the value of the auc_status
column is equal to 3 .
That is, as soon as the value of auc_status
is changed to 3 , it must execute the trigger.
I tried to do this:
DELIMITER $$
CREATE TRIGGER update_bid
AFTER UPDATE ON auction
FOR EACH ROW
BEGIN
IF (NEW.auc_status = '3') THEN
/* Conteúdo da trigger, que seriam dois updates em outra tabela */
END IF;
END$$
DELIMITER ;
Is this correct or should I do it differently? I use MySQL.