创建 MySQL 触发器的 SQL 语法错误
我尝试创建触发器
CREATE TRIGGER `aster_users2` after
update ON `aster_users` FOR EACH ROW
BEGIN update event set flag=1 where
id=1; END;
但遇到下一个错误
ERROR 1064 (42000):您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在第 6 行的end"附近使用的正确语法
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'end' at line 6
有解决这个问题的建议吗?
have suggestion to solve this problem ?
推荐答案
尝试从语句中删除分号.
Try removing the semi-colons from your statements.
如果您想保留分号,
DELIMITER $$
CREATE TRIGGER `aster_users2` after
update ON `aster_users` FOR EACH ROW
BEGIN update event set flag=1 where
id=1;
END$$
DELIMITER ;
相关文章