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萬條數據

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM