mysql 批量插入过程


 create procedure p7() 
       begin 
         DECLARE i INT DEFAULT 1;
         DECLARE pid INT DEFAULT 17224;
         DECLARE file_id INT DEFAULT 92490;
         DECLARE attmnt_rel_id INT DEFAULT 104735;  
         while i <= 10 do 
          set pid :=pid + 1;
          INSERT  INTO `ls_prod`(`prod_id`,`t_prod_id`,`sort_id`,`nsort_id`,`sub_nsort_id`,`global_sort`,`global_nsort`,`global_subsort`,`global_brand`,`model_id`,`party_code`,`name`,`prod_en_name`,`price`,`cash`,`inland_price`,`proxy_price`,`carriage`,`tax`,`brief`,`content`,`views`,`praise`,`buys`,`comments`,`rec_date`,`small_pic`,`use_small_pic`,`pic`,`is_commend`,`is_hot`,`status`,`modify_date`,`user_id`,`user_name`,`start_date`,`end_date`,`stocks`,`prod_type`,`key_word`,`attribute`,`parameter`,`user_parameter`,`brand_id`,`actual_stocks`,`reviewScores`,`volume`,`weight`,`transport_id`,`has_invoice`,`has_guarantee`,`after_sale_id`,`stock_counting`,`reject_promise`,`service_guarantee`,`site`,`currency`,`prod_url`,`is_for_trading`,`auxiliaryurl`,`restriction_number`,`rmb_total`,`is_lock`,`is_lock_price`,`site_status`,`rebate_code`,`rebate_url_id`,`is_quickbuy`,`meta_desc`,`meta_keyword`,`meta_title`,`is_self_support`,`release_user`,`outer_url`,`attributes`,`out_stocks`) VALUES 
           (pid,1,138,740,NULL,NULL,NULL,NULL,NULL,'','','性能测试专用商品','Test Product  123',NULL,0.010,0.00,0.000,0.010,NULL,'','<div align=\'center\'><img alt=\'\' src=\'http://img30.360buyimg.com/jgsq-productsoa/g13/M00/11/02/rBEhVFLPtgwIAAAAAABwO86sYfoAAHzUgGjpUgAAHBT273.jpg\' class=\'err-product\'></div>',227,2,0,14,'2015-01-26 20:21:23','','','g2/M00/00/FD/CgEHc1TPmZWALA-AAAHDql751r0299.jpg','N','N',0,'2015-02-12 22:45:36','402882823a9d5e0d013a9dabe3680002','home',NULL,NULL,4,'P',NULL,NULL,'[{\"key\":\"102\",\"value\":\"保湿补水\"},{\"key\":\"103\",\"value\":\"偏干及干性\"}]',NULL,114,10,5,11.040,0.000,NULL,0,0,NULL,0,NULL,NULL,'www.amazon.com','USD','http://item.jd.com/1057746.html',1,NULL,2,NULL,1,0,0,NULL,NULL,0,NULL,NULL,NULL,0,'',NULL,NULL,NULL);
           SET i :=i+1; 
           INSERT  INTO `ls_img_file`(`file_id`,`product_id`,`user_name`,`file_path`,`status`,`upoad_time`,`outer_url`) VALUES (file_id,pid,'home',NULL,1,'2015-05-25 00:00:00','g2/M00/00/FD/CgEHc1TPmZWALA-AAAHDql751r0299.jpg');
           SET attmnt_rel_id :=attmnt_rel_id+1;
           INSERT  INTO `ls_attmnt_rel`(`id`,`attachment_id`,`rel_id`,`rel_object`,`seq`) VALUES (attmnt_rel_id,6364,pid,'P',0);
           SET i :=i+1;
        end while; 
       end$

猜你喜欢

转载自annan211.iteye.com/blog/2257265
今日推荐