时间:2021-07-01 10:21:17 帮助过:22人阅读
<!--删除定时任务-->
DROP EVENT blog_info_delete;
<!--创建存储过程-->
CREATE PROCEDURE blog_info()
BEGIN
delete from blog_info where DATE(creater_time) <= DATE(DATE_SUB(now(),INTERVAL 7 DAY));
END;
<!--创建定时任务调用存储过程-->
create event blog_info_delete on SCHEDULE EVERY 1 DAY starts TIMESTAMP ‘2017-07-19 00:00:00‘
DO CALL blog_info()
<!--创建存储过程-->
CREATE PROCEDURE blog_info_account_rel()
BEGIN
delete from blog_info_account_rel where DATE(creater_time) <= DATE(DATE_SUB(now(),INTERVAL 7 DAY));
END
<!--创建定时任务调用存储过程-->
create event blog_info_account_rel_del on SCHEDULE EVERY 1 DAY STARTS TIMESTAMP ‘2017-07-19 00:00:00‘
DO CALL blog_info_account_rel()
数据库定时任务
标签:tar 定时任务 sch roc blog let end 存储 begin