drop procedure if exists u_head_and_low_pro;
delimiter //
create procedure u_head_and_low_pro()
begin
  DECLARE n int DEFAULT 0;
    WHILE n < 1000 DO
        insert into activity(data_code, coupon_activity_number, coupon_activity_title, coupon_activity_category,
                                coupon_activity_type, product_type, coupon_type, currency_type, full_amount,
                                decrease_amount, total_amount, take_amount, untake_amount, used_amount, per_user_limit,
                                effective_caculate_mode, begin_effective_time, end_effective_time,
                                coupon_activity_status, remark, create_by, create_time, update_by, update_time,
                                del_flag, lock_version)
values (CONCAT('248681711918', LPAD((@i:=n + 1), 4, 0)), left (upper (replace(uuid(), '-', '')), 5),
        "活动", 2, 2, 2, 1, "HKD", 1000, 100, 1, 0, 1, 0, 1, 1, "2017-02-01 00:00:00",
        "2018-02-25 23:59:59", 1, "后台批量添加1000条数据", "system", now(), "system", now(), 0, 0);
            set n = n + 1;
  END WHILE;
  commit;
end;;
call u_head_and_low_pro();

将查询结果批量插入另一张表

insert into rule(data_code,coupon_activity_code,trip_type,  begin_departure_time,end_departure_time,departure_days,remark,create_by,create_time,update_by,update_time,
        del_flag,lock_version)

        select
        CONCAT('258681711911', LPAD((@i:=@i + 1), 4, 0)) AS data_code,
        couponActivity.data_code,
        '["1","2"]',"2017-12-01 00:00:00","2018-09-01 23:59:59",'["1","2","3","4","5","6","7"]',
        "后台批量添加1000条数据","system",now(),"system",now(),0,0
        from activity as couponActivity,(select @i:=0) as it 
01-09 17:06