MySQL Forums
Forum List  »  Spanish

Re: Consultar variables
Posted by: William Chiquito
Date: July 28, 2008 07:53PM

Hola Jose,

Cuando te refieres a el "Evento", te refieres a la nueva característica desde la versión 5.1.6 de MySQL, CREATE EVENT? De ser así, es posible ejecutar una consulta preparada (PREPARE) dentro del cuerpo de un evento.

Mi ejemplo:
DELIMITER $$
SET GLOBAL event_scheduler = ON$$
CREATE EVENT `myevent`
ON SCHEDULE EVERY 5 SECOND
DO
BEGIN
	SET @qry = CONCAT('INSERT INTO mytable (mydate) VALUES (''', NOW(), ''')');
	PREPARE stmt1 FROM @qry;
	EXECUTE stmt1;
	DEALLOCATE PREPARE stmt1;
END$$
DELIMITER ;



Edited 2 time(s). Last edit at 07/28/2008 07:55PM by William Chiquito.

Options: ReplyQuote


Subject
Views
Written By
Posted
2866
July 28, 2008 07:02AM
2142
July 28, 2008 10:31AM
2058
July 28, 2008 12:03PM
1894
July 28, 2008 12:32PM
Re: Consultar variables
1933
July 28, 2008 07:53PM
1901
July 29, 2008 04:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.