mysql事件執行預存程序,mysql事件預存程序

來源:互聯網
上載者:User

mysql事件執行預存程序,mysql事件預存程序

CREATE PROCEDURE InitializationData()BEGINupdate 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 PRESERVEENABLEDOCALL InitializationData();

事件的意思是 從17:49:10 這個時間開始 每天 這個點執行這個事物


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.