解决在MySQL中建立存储过程时报出【check the manual that corresponds to your MySQL server version for the right ……】

 前后添加语句分隔符

delimiter //
create procedure add_t_workorder_end()
begin
  declare i int default 0;
  set i = 0;
  start transaction
    ;
    while i < 10000 do
    -- insert sql
    insert into t_workorder_calculation_end(end_count,time)
		  SELECT count(1) as end_count,DATE_FORMAT(date_sub('2022-08-14 00:00:00',interval i day),'%Y-%m-%d %H:%i:%s') as time from t_workorder where end_time between date_sub('2022-08-14 00:00:00',interval i day) and date_sub('2022-08-14 23:59:59' , interval i day) and end_time is not null;		
			
    set i = i + 1;
		if date_sub('2022-08-14 23:59:59',interval i day) < '2022-02-16 23:59:59' then set i = 10000;
		end if;
    end while;
  commit;
end
 //
call add_t_workorder_end()

DROP PROCEDURE IF EXISTS add_t_workorder_end

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值