我尝试通过phpmyadmin和body INSERT创建触发器AFTER UPDATE
:
BEGIN
INSERT INTO updatespersonal SET (user, time, type, operator) VALUES (NEW.idDetailToUsers, CURRENT_TIMESTAMP(), "detailtousers", "update");
END
但是我得到了错误,因为我无法理解:
第2行1064
双引号可能有问题吗?
答案 0 :(得分:4)
插入语句出错,请删除 SET 关键字:
INSERT INTO updatespersonal (user, time, type, operator) VALUES (NEW.idDetailToUsers, CURRENT_TIMESTAMP(), "detailtousers", "update");
答案 1 :(得分:1)
您的语法不正确。使用 INSERT INTO 时,您无需SET
。
您的代码应为:
BEGIN
INSERT INTO updatespersonal (user, time, type, operator) VALUES (NEW.idDetailToUsers, CURRENT_TIMESTAMP(), "detailtousers", "update");
END
答案 2 :(得分:0)
2个问题
您使用关键字作为列名用户。将其括在""
中 BEGIN
INSERT INTO updatespersonal ("user", time, type, operator) VALUES (NEW.idDetailToUsers, CURRENT_TIMESTAMP(), "detailtousers", "update");
END