DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`item_beforeUpdate` BEFORE UPDATE ON `item` FOR EACH ROW BEGIN DECLARE vNewPackingShelve INT; SET NEW.editorFk = account.myUser_getId(); IF NEW.itemPackingTypeFk = '' THEN SET NEW.itemPackingTypeFk = NULL; END IF; END$$ DELIMITER ;