随笔编号-08 MYSQL 存储过程,5分钟执行调用过程;

delimiter //
DROP PROCEDURE
IF EXISTS jdt.day_instan_data_task//

CREATE PROCEDURE jdt.day_instan_data_task (
IN `var_s_date` VARCHAR (20),
`var_e_date` VARCHAR (20)
)
BEGIN
DECLARE
nowdate datetime DEFAULT NOW() ; DECLARE
endtmp datetime DEFAULT NOW() ;
SET nowdate = str_to_date(var_s_date,'%Y-%m-%d %H:%i:%s') ;
SET endtmp = str_to_date(var_e_date,'%Y-%m-%d %H:%i:%s') ;
WHILE nowdate < endtmp DO
SET nowdate = DATE_ADD(nowdate, INTERVAL 5 MINUTE) ;
CALL sp_call_hang_lie_task (99, nowdate) ;
CALL sp_hang_lie_del_result () ;
CALL sp_hang_lie_in_result () ;
END
WHILE ;
END//

delimiter ;

posted @ 2017-02-14 08:43  塞壬的港湾  阅读(280)  评论(0编辑  收藏  举报