【发布时间】:2012-04-13 12:39:40
【问题描述】:
我正在尝试在一个表上设置触发器以将行的内容复制到另一个表中。
我有以下:
CREATE TRIGGER story_deleted BEFORE DELETE ON stories
FOR EACH ROW BEGIN
INSERT INTO stories_backup SET story_id = OLD.story_id;
END;
这会返回以下错误:
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
我不知道我哪里出了问题。有什么想法吗?
【问题讨论】:
-
代码正确。你是如何在 phpmyadmin 中执行这个查询的?
-
作为一种解决方法 - 尝试删除 BEGIN 和 END 关键字。
-
试图在 phpMyAdmin 中执行...
-
源对象和分隔符可能有问题。尝试解决方法。
-
@Devart 这将返回以下内容:
1419 - You do not have the SUPER privilege and binary logging is enabled