Reputation: 179
Event structure:
CREATE DEFINER=`root`@`localhost` EVENT `EVENT_NAME` ON SCHEDULE EVERY 5 MINUTE STARTS '2013-07-01 09:00:00' ENDS '2013-07-01 09:38:00' ON COMPLETION PRESERVE ENABLE DO update ... Event Query ...
this is going to allow the event query to run every five minutes only from 9:00 till 9:38
but after it hits 9:38 the event ends and it doesn't work again automatically by it self the next day because its disabled.
any solution i might be missing for this ?
Upvotes: 0
Views: 80
Reputation: 9853
Sadly I don't think that the SCHEDULE
specification of a MySQL event is as flexible as the INTERVAL
.
You could roll your own using something like this though:
delimiter $$
CREATE DEFINER=`root`@`localhost`
EVENT `EVENT_NAME`
ON SCHEDULE EVERY 5 MINUTE
ON COMPLETION PRESERVE ENABLE
DO
BEGIN
IF (hour(now()) = 9 AND minute(now()) <= 38) THEN
-- Do your stuff here
END IF;
END$$
Upvotes: 1