时间:2021-07-01 10:21:17 帮助过:22人阅读
查看event是否开启
show variables like ‘%sche%‘;
开启event_scheduler
set global event_scheduler =1;
创建存储过程spark.test
CREATE PROCEDURE spark.test () BEGIN update spark.userbehaviordatasource set v1 = 3 where page like ‘page2%‘; END;
创建event spark.e_test
create event if not exists spark.e_test on schedule every 60 second on completion preserve do call spark.test();
每隔一分钟执行存储过程spark.test
关闭事务任务
alter event spark.e_test ON COMPLETION PRESERVE DISABLE;
开启事务任务
alter event spark.e_test ON COMPLETION PRESERVE ENABLE;
删掉存储过程
drop procedure spark.test;
插入数据
insert into spark.userbehaviordatasource(page, v1, v2, v3) values ("page25", 1.6, 1.3, 1)
查询出来的数据
参考:http://blog.csdn.net/tjcyjd/article/details/11481459
mysql定时任务
标签:proc where com cal sdn call roc park set