CREATE TRIGGER event_house_dealed AFTER UPDATE ON house FOR EACH ROW
BEGIN
DECLARE finished INT;
IF NEW.isdeal = 1 THEN
SET finished = 1;
END IF;
END;
MySQL服务器一直在说
SQL错误(1064):您输入了错误 你的SQL语法;检查手册 对应于您的MySQL服务器 用于正确语法的版本 'IF NEW.isdeal = 1那么设置附近 在第1行完成= 1'
感谢。
答案 0 :(得分:2)
您需要在定义触发器
之前更改分隔符DELIMITER ||
CREATE TRIGGER event_house_dealed AFTER UPDATE ON house FOR EACH ROW
BEGIN
DECLARE finished INT;
IF NEW.isdeal = 1 THEN
SET finished = 1;
END IF;
END||
然后当然将分隔符更改回;
DELIMITER ;
声明函数和存储过程也是如此