DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_afterUpdate` AFTER UPDATE ON `entry` FOR EACH ROW BEGIN IF NOT (NEW.travelFk <=> OLD.travelFk) THEN CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck SELECT b.id FROM buy b WHERE b.entryFk = NEW.id; CALL buy_checkItem(); END IF; END$$ DELIMITER ;