I am trying to create a procedure which create an event in MySQL.
For example, something similar to this:
delimiter // CREATE PROCEDURE schedule_my_db_job() BEGIN CREATE EVENT MY_DB_JOB ON SCHEDULE EVERY 1 MINUTE DO BEGIN SELECT * FROM information_schema.events; -- for example END; END// delimiter ;
But it gives me following error when I try to create this procedure.
ERROR 1576 (HY000): Recursion of EVENT DDL statements is forbidden when body is present
As I understand MySQL allow stored procedures to have CREATE EVENT sql statement inside. (Quotation from https://dev.mysql.com/doc/refman/5.6/en/create-event.html "You can create an event as part of a stored routine, but an event cannot be created by another event")
Could you please let me know what is the error here?