zoukankan      html  css  js  c++  java
  • mysql利用存储过程造数据

    drop procedure if exists t_add; -- 如果存在t_add 存储过程则删除
    create procedure t_add(num int)
    
    begin
    declare i int;
    set i=0;
    while i<num do
    
    INSERT INTO `coffee`.`delivery_trade` (`merchant_id`, `merchant_name`, `delivery_type`, `product_code`, `product_name`, `batch_no`, `manufacture_name`, `unit`, `product_type`, `sale_time`, `sale_num`, `customer_name`, `sale_no`, `transaction_no`, `production_date`, `validity_date`, `is_sent`, `is_delete`, `is_update`, `create_by`, `create_time`, `update_by`, `update_time`, `version`, `order_source`, `sale_price`, `checker`, `consumer_warehouse_addr`, `consumer_phone`, `acceptance_conclusion`, `reason`, `upload_type`, `original_sale_no`, `original_sale_time`, `shtxd_no`, `warehouse_id`, `enterprice_register_name`, `original_trade_no`, `carrier_name`)
    VALUES ('4', '广东壹号药业有限公司', '4', '0009716943', '南国牌   维生素B1片 100片', '43242', NULL, '', '-10', '2018-08-01 16:25:10', '3', '广东壹号大药房连锁有限公司', '7024650199', i + 1, '2018-06-24', '2020-06-23', '0', '0', '0', NULL, '2018-08-02 14:28:15', NULL, '2018-08-02 14:28:15', '0', 'A3A', '499.810000', '杜文堂', '广州市萝岗区瑞祥路355号综合厂房三2楼场地', '020-82042252', '合格', NULL, '5', NULL, NULL, 'DO2018080100001', '13', '广东壹号大药房连锁有限公司', NULL, '壹号药业');
    
    set i=i+1;
    end while;
    end;
    
    call t_add(100000); -- 调用存储过程,插入10万条数据
  • 相关阅读:
    【bzoj1191】 HNOI2006—超级英雄Hero
    【poj3020】 Antenna Placement
    【poj1274】 The Perfect Stall
    【poj2724】 Purifying Machine
    【poj2226】 Muddy Fields
    【codevs1257】 打砖块
    【poj2186】 Popular Cows
    【poj1236】 Network of Schools
    【poj1144】 Network
    【poj3177】 Redundant Paths
  • 原文地址:https://www.cnblogs.com/durp/p/9415605.html
Copyright © 2011-2022 走看看