ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
创建存储过程: ~~~ delimiter // CREATE PROCEDURE clean_expire_chk () BEGIN delete from zc_chkdup_stat where substring( starttime,1,8) < (date_format(adddate(CURDATE(),-8), '%Y%m%d')) ; END// delimiter ; ~~~ 定义定时任务: ~~~ SET GLOBAL event_scheduler = 1; CREATE EVENT IF NOT EXISTS event_clear_data_chk ON SCHEDULE EVERY 1 day starts '2008-03-27 09:00:00' ON COMPLETION PRESERVE DO CALL clean_expire_chk(); ~~~ 开启定时任务: `ALTER EVENT event_clear_data_chk on COMPLETION PRESERVE ENABLE; ` 删除存储过程和定时任务: ~~~ drop PROCEDURE clean_expire_chk ; drop EVENT event_clear_data_chk ; ~~~