Taengoo Kim
Taengoo Kim

Reputation: 67

MySQL on event schedule

I'm getting the following error:

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 7

DELIMITER$$
CREATE EVENT myevs
ON SCHEDULE EVERY 1 DAY

DO 
 BEGIN
   INSERT INTO ww SELECT * FROM fff WHERE dates = NOW()
   DELETE FROM fff where dates = NOW()
END$$

DELIMITER;

Upvotes: 0

Views: 106

Answers (1)

Mureinik
Mureinik

Reputation: 312136

You are missing semicolons (;) at the end of the insert and delete statements:

DELIMITER$$
CREATE EVENT myevs
ON SCHEDULE EVERY 1 DAY

DO 
 BEGIN
   INSERT INTO ww SELECT * FROM fff WHERE dates = NOW();
   -- Here --------------------------------------------^

   DELETE FROM fff where dates = NOW();
   -- And here -----------------------^
END$$

DELIMITER;

Upvotes: 1

Related Questions