DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`province_afterUpdate` AFTER UPDATE ON `province` FOR EACH ROW BEGIN IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN CALL zoneGeo_setParent(NEW.geoFk, (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); END IF; IF !(OLD.`name` <=> NEW.`name`) THEN UPDATE zoneGeo SET `name` = NEW.`name` WHERE id = NEW.geoFk; END IF; END$$ DELIMITER ;