我在mysql中创建触发器时遇到问题我收到此错误:
#1064 - 您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在第7行附近使用正确的语法
这是我第一次为mysql帮助创建触发器
以下是代码:
CREATE TRIGGER insertAfterUser AFTER INSERT ON MEMBERS
FOR EACH ROW
BEGIN
INSERT INTO blagajna (MemberId,StanjeRacuna) VALUES(12,0.0);
END;
答案 0 :(得分:1)
CREATE TRIGGER `insertAfterUser ` BEFORE INSERT ON `members` FOR EACH ROW BEGIN INSERT INTO blagajna (MemberId,StanjeRacuna) VALUES('12','0.0'); END;
答案 1 :(得分:1)
您需要设置分隔符
delimiter //
CREATE TRIGGER insertAfterUser AFTER INSERT ON MEMBERS
FOR EACH ROW
BEGIN
INSERT INTO blagajna (MemberId,StanjeRacuna) VALUES(12,0.0);
END;//
delimiter ;