码迷,mamicode.com
首页 > 数据库 > 详细

mysql事件执行存储过程

时间:2015-06-15 18:42:07      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:mysql   存储过程   

CREATE PROCEDURE InitializationData()
BEGIN
update yt_products set number=number+100 where id=1;
update yt_products set number=number+100 where id=2;
update yt_products set number=number+100 where id=3;
update yt_products set number=number+50 where id=4;
update yt_products set number=number+1 where id=5;
update yt_products set number=number+1 where id=6;
update yt_products set number=number+1 where id=7;
update yt_products set number=number+1 where id=8;
update yt_products set number=number+10 where id=9;
update yt_products set number=number+10 where id=10;
update yt_products set number=number+10 where id=11;
update yt_products set number=number+10 where id=12;
update yt_products set number=number+5000 where id=13;
update yt_products set number=number+6000 where id=14;
END;


然后创建事件

CREATE  EVENT `NewEvent`
ON SCHEDULE EVERY 1 DAY STARTS '2015-04-01 17:49:10'
ON COMPLETION NOT PRESERVE
ENABLE
DO
CALL InitializationData();

事件的意思是 从17:49:10 这个时间开始 每天 这个点执行这个事物


mysql事件执行存储过程

标签:mysql   存储过程   

原文地址:http://blog.csdn.net/windlee09/article/details/46506307

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!