Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create an event inside a procedure - SQL

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?

like image 806
richardaum Avatar asked Sep 11 '26 14:09

richardaum


1 Answers

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

like image 180
Rahul Avatar answered Sep 13 '26 13:09

Rahul