简体   繁体   中英

Getting Error #1064 Near End When Trying to Create a Trigger

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 ;

I am getting the error:

#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

Have tried messing around with the syntax to match examples I have seen but with no luck.

Using MySQL on phpmyadmin if that helps.

Thank you.

You are missing ; at the end of 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 ;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM