MySQL 循环语句
https://blog.csdn.net/yangzjchn/article/details/82705565
自己测试用的数据
delimiter // #定义标识符为双斜杠
drop procedure if exists zhqc_scwl_celue_dxf; #如果存在zhqc_scwl_celue_dxf存储过程则删除
create procedure zhqc_scwl_celue_dxf() #创建无参存储过程,名称为zhqc_scwl_celue_dxf
begin
declare i int; #申明变量
declare ab int;
set i = 1; #变量赋值
set ab = 92105250;
while i < 10000 do #结束循环的条件:当i大于10000时跳出while循环
-- 主表导入(ib_tt_in_order id)
INSERT INTO `zhqc_oms_scwl_test`.`ib_tt_in_order`(`id`, `company_code`,
`wh_id`, `owner_id`, `in_order_no`, `order_status`, `order_type`, `order_orig`,
`orig_no`, `supplier_id`, `exp_arrival_time`, `remark`, `buyer`, `creator`,
`create_time`, `updater`, `update_time`, `optimistic`, `supplier_name`, `owner_name`,
`order_price`, `store_id`, `store_name`, `customer_id`, `customer_name`, `sc_order_type`,
`sc_business_type`, `old_num`, `return_courier_num`, `is_self`, `shipper`,
`shipper_contact`, `shipper_tel`, `consignee`, `consignee_contact`, `consignee_tel`,
`carrier_name`, `shipping_date`, `receiving_date`, `operation_date`, `shipper_id`,
`consignee_id`, `shipper_prov_id`, `shipper_city_id`, `shipper_area_id`, `shipper_addr`,
`shipper_prov_name`, `shipper_city_name`, `shipper_area_name`, `orig_order_code`) VALUES
(ab, 'SCWL', 201016000000106, 210318000000001, ab, 'ORDER_COMP',
'CGDDZP', 'SG_CJ', ab, 0, NULL, '', NULL, 'huangdong', '2021-05-25 16:48:45', 'suminju',
'2021-06-09 17:38:09', 0, '', '恒大农牧集团销售公司', 0, NULL, NULL, NULL, NULL, 'PRO_WAREHOUSING', '', '', '',
'2000', '安图恒大长白山矿泉水有限公司', '崔景风', '1', '山东递速测试仓', '递速测试', '18128765145', '2', NULL, NULL,
'2021-05-25 00:00:00', 3, 201016000000106, 7, 59, 585, '吉林省安图县二道白河镇红丰村', '吉林省',
'延边朝鲜族自治州', '安图县', '');
-- 子表导入(ib_tt_in_order_dt in_order_id)
INSERT INTO `zhqc_oms_scwl_test`.`ib_tt_in_order_dt`(`id`, `company_code`, `in_order_id`, `sku_id`, `sys_sku_code`,
`sku_code`, `in_order_qty`, `vol`, `gross_weight`, `net_weight`, `amount`, `remark`, `ext_one`, `ext_two`,
`ext_three`, `ext_four`, `ext_five`, `ext_six`, `brand_name`, `temp_control_name`, `creator`, `create_time`, `updater`,
`update_time`, `optimistic`, `sku_name`, `trade_name`, `drug_form`, `spec`, `main_unit`, `row_no`, `rec_qty`, `reject_qty`,
`rec_vol`, `rec_gross_weight`, `status`, `row_supplier_id`, `row_supplier_name`, `batch_no`, `origin_country`, `mfg`,
`mfg_id`, `approve_no`, `drug_form_spec`, `barcode`, `production_batch`, `production_date`, `invalid_date`, `vol_dec`,
`gross_weight_kg`, `amount_dec`) VALUES (ab, 'SCWL', ab, 210429000000001, 'SS210429000000001',
'2012104291', 10, 0, 100200, 10000, 0, '', '10', NULL, NULL, NULL, NULL, NULL, NULL, '0', 'huangdong', '2021-05-25 16:48:45',
'huangdong', '2021-05-25 16:48:45', 00000000000, '农夫山泉', '0', '', '250ml', '箱', 1, 0, 0, 0, 0, 'NEW', 0, '',
'20210521', NULL, NULL, NULL, NULL, NULL, '6923987712323', NULL, '2021-05-25', NULL, 0.010, 100.200, 201.00);
set i = i + 1; #循环一次,i加一
set ab = ab + 1;
end while; #结束while循环
end
// #结束定义语句