尝试创建触发器时,获取错误#1064接近结束

n53p2ov0  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(400)
DELIMITER $$
CREATE TRIGGER DELETETRIGGER AFTER DELETE ON WORKLOG
  FOR EACH ROW
  BEGIN
    INSERT INTO WORKLOGCOPY (Log_ID, Order_ID, Employee_ID, Client_ID, 
Work_Completed, Hours_Taken, Date_Logged)
    VALUES(OLD.Log_ID, OLD.Order_ID, OLD.Employee_ID, OLD.Client_ID, 
OLD.Work_Completed, OLD.Hours_Taken, OLD.Date_Logged)
  END$$
DELIMITER ;

我得到一个错误:


# 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 
'END' at line 6

我试过在语法上乱来,以匹配我见过的例子,但没有运气。
在phpmyadmin上使用mysql如果有帮助的话。
谢谢您。

ijnw1ujt

ijnw1ujt1#

你失踪了 ; 结束时 INSERT INTO ```
DELIMITER $$
CREATE TRIGGER DELETETRIGGER AFTER DELETE ON WORKLOG
FOR EACH ROW
BEGIN
INSERT INTO WORKLOGCOPY (Log_ID, Order_ID, Employee_ID, Client_ID,
Work_Completed, Hours_Taken, Date_Logged)
VALUES(OLD.Log_ID, OLD.Order_ID, OLD.Employee_ID, OLD.Client_ID,
OLD.Work_Completed, OLD.Hours_Taken, OLD.Date_Logged);
END$$
DELIMITER ;

相关问题