DELIMITER $$ DROP PROCEDURE IF EXISTS article_clickCount_procedure $$
CREATE PROCEDURE article_clickCount_procedure() BEGIN
DECLARE flag INT DEFAULT 0; DECLARE articleId INT DEFAULT 0; DECLARE curArticle CURSOR FOR SELECT id FROM YcArticle; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET flag = 1; OPEN curArticle; FETCH curArticle INTO articleId; WHILE(flag !=1) DO UPDATE YcArticle SET todayClickCount = 0 WHERE id = articleId; FETCH curArticle INTO articleId; END WHILE; END $$ DELIMITER ;
CREATE EVENT IF NOT EXISTS event_article_clickCount_procedure ON SCHEDULE EVERY 24 HOUR STARTS CURDATE() + 1 ON COMPLETION PRESERVE DO CALL article_clickCount_procedure();
SHOW VARIABLES LIKE '%sche%'; SET GLOBAL event_scheduler = 1;
[code="java"]DELIMITER $$DROP PROCEDURE IF EXISTS article_clickCount_procedure $$CREATE PROCEDURE article_clickCount_procedure()BEGINDECLARE flag INT DEFAULT 0;DECLARE articleId INT DE...