gettting an error while defining the event name on mysqlworkbench 5.5

蓝咒 提交于 2019-12-02 08:50:42
Rahul

Per documentation you can't create event inside procedure body. See this post Create an event inside a procedure - SQL.

You will have to create the procedure first and then call it from event like below

DELIMITER $$

CREATE DEFINER=`MailMe`@`%` PROCEDURE `sp_archivev3`()
BEGIN

INSERT INTO 
     send.sgev3_archive(a_bi,
                        b_vc,
                        c_int,
                        d_int,
                        e_vc,

<Rest of the code goes here>

Then create event calling the procedure

DELIMITER $$  
CREATE EVENT archivescheduler
ON SCHEDULE EVERY 10 SECOND
DO BEGIN
    CALL `sp_archivev3`();
END $$
DELIMITER ;

Another Pointer: In case your stored procedure don't fire from event; you may need to check whether GLOBAL EVENT SCHEDULER is in DISABLE state. You can turn it on using below setting

SET GLOBAL event_scheduler = ON;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!