1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| CREATE PROCEDURE insert_product3(IN total BIGINT) BEGIN DECLARE start_key BIGINT DEFAULT 0; DECLARE max_id BIGINT DEFAULT 0;
SELECT COUNT(1) into max_id from product;
WHILE start_key<total DO SET max_id=max_id+1; INSERT INTO product(product_title,product_name,remarks,merchant_id,create_time,update_time,classify_1,classify_2,classify_3,brand_id,user_id,user_ip,freight,pic_url,sales_amount,product_amount,product_status) VALUES(CONCAT('商品_iphone8_title_test_',max_id),CONCAT('商品_iphone8_name_test_',max_id),CONCAT('商品_iphone8_remrk_test_',max_id),max_id,NOW(),NOW(),1,1,1,1,1000,'192.168.18.100',5000,'http://www.baidu.com',5000,5000,0); SET start_key=start_key+1; COMMIT; END WHILE ;
END;
-- call insert_product3(10)
|