DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerMana_beforeUpdate` BEFORE UPDATE ON `workerMana` FOR EACH ROW BEGIN IF (SELECT EXISTS(SELECT TRUE FROM workerManaExcluded WHERE workerFk = NEW.workerFk)) THEN CALL util.throw('Worker is excluded from mana'); END IF; END$$ DELIMITER ;