MySQL触发器导致错误#1064

时间:2010-11-13 05:50:09

标签: mysql sql triggers mysql-error-1064

我尝试在MySQL中编写这个小触发器,

CREATE TRIGGER `leg` BEFORE INSERT ON `bckoff` 
FOR EACH ROW BEGIN
 INSERT INTO `bckoff` SET `step`=1;
END;

之后我收到此错误..我是MySQL的新手..所以请在这里帮助我..

#1064 - 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 '' at line 3 

1 个答案:

答案 0 :(得分:2)

即使你修复了这个错误 - 你还会得到另一个错误:你无法修改你的触发器所在的表。

顺便说一下,这就是你应该如何创建这个触发器:

delimiter |

CREATE TRIGGER `leg` BEFORE INSERT ON `bckoff` 
FOR EACH ROW BEGIN
 INSERT INTO `bckoff` SET `step`=1;
END;
|

delimiter ;