How to get multiple MySQL statements in one scheduled event?

I am trying to make two statements in one scheduled event, but it does not work. He will do nothing. Could you help me figure out what is wrong?

delimiter | CREATE EVENT resetTimeClockTimeToday ON SCHEDULE EVERY 1 DAY STARTS '2012-07-10 00:00:00' DO BEGIN UPDATE timeclock.employees SET timeToday = 0; UPDATE timeclock.punches SET missedOut = 1 WHERE timeOUT IS NULL; END| delimiter ; 
+4
source share
2 answers

I restarted the MySQL service and it worked!

-4
source

You need to use another separator correctly, for example:

 DROP EVENT IF EXISTS `Daily Event`; DELIMITER $$ CREATE DEFINER=`root`@`localhost` EVENT `Daily event` ON SCHEDULE EVERY 1 DAY STARTS '2015-03-06 00:30:00' ON COMPLETION PRESERVE ENABLE DO BEGIN -- Newly due summary sheets UPDATE `summaries` SET `status` = 'DUE' WHERE `status` = 'OPEN' AND NOW() >= LAST_DAY(CONCAT(`year`, '-', `month`, '-01')); -- Alert user that didn't clock out INSERT INTO `alerts` (`from`, `to`, `subject`, `message`) SELECT ....; -- Alert manager that didn't clock out INSERT INTO `alerts` (`from`, `to`, `subject`, `message`) SELECT ....; -- Alert for stale tickets INSERT INTO `alerts` (`from`, `to`, `subject`, `message`) SELECT ....; END; $$; 
-1
source

All Articles