我创建了一个简单的触发器,如下所示:
CREATE TRIGGER `trigger_update_rche_prep` BEFORE UPDATE ON `rche_prep`
FOR EACH ROW
SET NEW.case_number = 'ABC';
当我想向其添加BEGIN...END
语法时,哪个有效,如下所示:
CREATE TRIGGER `trigger_update_rche_prep` BEFORE UPDATE ON `rche_prep`
FOR EACH ROW
BEGIN
SET NEW.case_number = 'ABC';
END;
它失败了,我不知道为什么会这样,有人可以帮忙吗?
答案 0 :(得分:0)
试试这个:
DELIMITER //
CREATE TRIGGER `trigger_update_rche_prep` BEFORE UPDATE ON `rche_prep`
FOR EACH ROW
BEGIN
SET NEW.case_number = 'ABC';
END;//
DELIMITER ;