Create an event inside a procedure - SQL

你说的曾经没有我的故事 提交于 2019-12-23 17:10:51

问题


I need to create an event inside a procedure, I read somewhere that it's possible but I don't know the syntax. I'm trying:

CREATE PROCEDURE DUMMY_PROCEDURE() 
BEGIN 
CREATE event e on schedule every 1 second DO 
INSERT INTO test.t values (current_timestamp); 
END; 

But it throws:

Any ideas on how to do this?, thanks for reading.

'#1576 - Recursion of EVENT DDL statements is forbidden when body is present

Edit1:
The reason I want to create an event within an event procedure is because it acts as an expiration date, so the function is executed an event with very specific parameters is also created, so when the expiration date arrives, automatically bank makes a particular action. Understand?


回答1:


You can't create an event inside procedure body. See this http://www.peregrinesalon.com/wp-content/uploads/2009/03/mysql-stored-procedures.pdf



来源:https://stackoverflow.com/questions/8357174/create-an-event-inside-a-procedure-sql

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