【发布时间】:2018-08-25 13:13:08
【问题描述】:
我已经为我的数据库编写了触发器。
CREATE TRIGGER executor_type_check BEFORE INSERT ON executors
FOR EACH ROW
BEGIN
IF NEW.points <> 100
SET NEW.points = 0;
END IF;
END
导入sql文件时出现以下错误
You have an error in your SQL syntax;
check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SET NEW.points = 0' at line 5
我的 .sql 文件结构如下:
- 数据库创建
- 开始交易
- 创建表格
- 触发器的创建
- 提交
不触发不显示错误。
【问题讨论】:
-
缺少
then? -
缺少'; ' 结束后
-
尝试将
DELIMITER $$或类似的东西放在触发器定义之前。
标签: mysql sql database triggers xampp