在过程中创建一个事件——SQL

时间:2021-10-08 03:18:38

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

'#1576 -当body出现时,禁止递归事件DDL语句

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?

Edit1:我想在事件过程中创建事件的原因是它作为一个过期日期,所以函数执行一个带有非常特定参数的事件,所以当过期日期到来时,自动银行会做出特定的动作。明白吗?

1 个解决方案

#1


3  

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

不能在过程主体内部创建事件。看到这个http://www.peregrinesalon.com/wp-content/uploads/2009/03/mysql-stored-procedures.pdf

#1


3  

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

不能在过程主体内部创建事件。看到这个http://www.peregrinesalon.com/wp-content/uploads/2009/03/mysql-stored-procedures.pdf