mysql – 在商店过程中创建事件

如何在商店程序中创建事件?

这是我一直在尝试做的,它告诉我,我有一个语法错误,只是它没有告诉我在哪里.

-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `update_leaderboard`()
BEGIN


CREATE EVENT update_leaderboard_event
    ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 minute
    DO call update_leaderboard();



END

编辑:
根据我的MySql(最后一行),它应该是可能的:

Syntax”. You can create an event as part of a stored routine, but an
event cannot be created by another event.

Edit2发现了问题:

Error 1576: Recursion of EVENT DDL statements is forbidden when body
is present

但还没有解决方案,那我该怎么做呢?

最佳答案 你不能创建内部程序.您需要单独定义它.

只需检查Mysql Event Scheduler
详细博客:http://goo.gl/6Hzjvg

点赞