Mysql scheduled task and stored procedure instance

Source: Internet
Author: User

/** Check whether the event is Enabled: show variables like '% event_sche %'; enable the event plan: set global event_scheduler = 1; disable the event plan: set global event_scheduler = 0; close EVENT task: alter event eventName on completion preserve disable; enable event task: alter event eventName on completion preserve enable; view EVENT task: show events; delimiter // sets the statement terminator to //, which is used by the Stored Procedure statement. End **/drop table if exists test; create table test (id bigint (11) unsigned not null AUTO_INCREMENT, name varchar (100) not null default '', create_time datetime, primary key (ID) ENGINE = InnoDB AUTO_INCREMENT = 1 default charset = utf8; DELIMITER // drop procedure if exists p_test // create procedure p_test () begin insert into test (name, create_time) values ('testname', now ()); END // drop event if exists e_test // create event e_test on schedule every 10 second starts timestamp '2017-04-09 01:00:00 'on completion preserve do begin call p_test (); END //

The preceding event e_test indicates that p_test () is executed every 10 seconds ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.