Error while creating MySql event scheduling for a specific period of time everyday with an interval of 1 hour.
My code are
CREATE EVENT your_event ON SCHEDULE
EVERY 30 MINUTE
STARTS '2013-10-01 10:00:00'
DO
IF time(CURRENT_TIMESTAMP) between time('10:00:00') and time('18:00:00')
then
INSERT INTO andrew (name) values ('test')
end if
and the error is:
#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 if' at line 8
Try this;)
DELIMITER $$
CREATE EVENT your_event ON SCHEDULE
EVERY 30 MINUTE
STARTS '2013-10-01 10:00:00'
DO
IF time(CURRENT_TIMESTAMP) BETWEEN time('10:00:00') AND time('18:00:00') THEN
INSERT INTO andrew (name) VALUES ('test');
END IF $$
DELIMITER ;