1

我想要以下 3 个触发器:

#START TRIGGER
delimiter $$
CREATE TRIGGER `lastedited` AFTER UPDATE ON `eng-jap`
FOR EACH ROW
BEGIN
UPDATE `mrhowtos_main`.`eng` 
SET `english` = new.eng WHERE `english` = old.eng;
UPDATE `mrhowtos_main`.`jap` 
SET `japanese` = new.jap WHERE `japanese` = old.jap;
END;
$$


#START TRIGGER
delimiter $$
CREATE TRIGGER `lastedited2` AFTER UPDATE ON `eng`
FOR EACH ROW
BEGIN
UPDATE `mrhowtos_main`.`eng-jap` 
SET `eng-jap`.`eng` = new.english WHERE `eng-jap`.`eng` = old.english;
END;
$$


#START TRIGGER
delimiter $$
CREATE TRIGGER `lastedited3` AFTER UPDATE ON `jap`
FOR EACH ROW
BEGIN
UPDATE `mrhowtos_main`.`eng-jap` 
SET `eng-jap`.`jap` = new.japanese WHERE `eng-jap`.`jap` = old.japanese;
END;
$$

但在我创建它们之前,我看到一旦任何表得到更新,触发器就会无限循环。基本上我不希望触发器 UPDATE “触发”其他触发器。我怎么做?

4

0 回答 0