1、创建存储过程
-- 创建存储过程
DELIMITER $$
create procedure insert_tophatter_record(n int)
begin
declare i int default 0;
set autocommit = 0;
repeat
set i = i + 1;
INSERT INTO `ueb_tophatter_list` (`account`, `sku`, `sku_identifier`, `internal_id`, `category`, `title`, `description`, `condition`,
`is_multi`, `brand`, `material`, `retail_price`, `cost_basis`, `minimum_bid_amount`, `scheduling_fee_bid`,
`max_daily_schedules`, `shipping_price`, `shipping_origin`, `weight`, `days_to_fulfill`,
`days_to_deliver`, `expedited_shipping_price`, `expedited_days_to_deliver`, `buy_one_get_one_price`,
`primary_image`, `extra_images`, `available_quantity`, `all_images_json`, `ratings_count`, `ratings_average`,
`created_at`, `updated_at`, `disabled_at`, `deleted_at`, `catalog_only_at`, `created_in`, `created_by`, `updated_in`,
`updated_by`, `status`, `publish_in`, `publish_data_url`, `error_remark`)
VALUES ('19951103', 'JM10697', 'JM10697_20181205152406_1217', '18204119', 'Accessories | Bags | Shoulder Bags & Hobos', '24Pcs/Box Triangle Beads Rhinestone Decoration Artificial False Fake Nail Art Tip & Glue', 'Features: \r\nMade of advanced environmental plastic material, which is durable and friendly to your nails and the environment. \r\nGreat for both professional nail specialist and nail art learner. \r\nIt\'s easy to remove for its surface does not stick to the nail gel or acrylic. \r\nThis natural nail art tip is easy to cut, file and apply owing to the perfect length and thickness. \r\nSuitable for nail art with nail polish, UV gel, etc. \r\n \r\nSpecifications: \r\nItem Type: False Nail \r\nMaterial: Plastic \r\nMain Color: As the Picture Shows \r\nQuantity: 24Pcs/Box \r\nWeight: 28g \r\nFunction: Nail Art Decoration \r\n \r\nPackage Includes: \r\n1 x 24Pcs/Box of False Nails \r\n1 x 2g/bottle Glue', 'New', '0', '', '', '0.00', '2.00', '0.00', '0.00', NULL, '2.35', 'China', NULL, '5', '5', '0.00', NULL, '0.00', '/upload/image/Thumb_no_logo/JM14765-01/JM14765-01-2.jpg', '/upload/image/Thumb_no_logo/JM14765-01/JM14765-01-12.jpg|/upload/image/Thumb_no_logo/JM14765-01/JM14765-01-16.jpg', '0', '[{\"thumbnail\":\"https:\\/\\/images.tophatter.com\\/72639e96d55ab4aa79225e2bf2f93897\\/thumbnail.jpg\",\"square\":\"https:\\/\\/images.tophatter.com\\/72639e96d55ab4aa79225e2bf2f93897\\/square.jpg\",\"medium\":\"https:\\/\\/images.tophatter.com\\/72639e96d55ab4aa79225e2bf2f93897\\/medium.jpg\",\"large\":\"https:\\/\\/images.tophatter.com\\/72639e96d55ab4aa79225e2bf2f93897\\/large.jpg\",\"original\":\"https:\\/\\/images.tophatter.com\\/72639e96d55ab4aa79225e2bf2f93897\\/original.jpg\"},{\"thumbnail\":\"https:\\/\\/images.tophatter.com\\/89fd029261288d7e23aac06931238366\\/thumbnail.jpg\",\"square\":\"https:\\/\\/images.tophatter.com\\/89fd029261288d7e23aac06931238366\\/square.jpg\",\"medium\":\"https:\\/\\/images.tophatter.com\\/89fd029261288d7e23aac06931238366\\/medium.jpg\",\"large\":\"https:\\/\\/images.tophatter.com\\/89fd029261288d7e23aac06931238366\\/large.jpg\",\"original\":\"https:\\/\\/images.tophatter.com\\/89fd029261288d7e23aac06931238366\\/original.jpg\"},{\"thumbnail\":\"https:\\/\\/images.tophatter.com\\/7b7b651be4bd666b5750053314477f8e\\/thumbnail.jpg\",\"square\":\"https:\\/\\/images.tophatter.com\\/7b7b651be4bd666b5750053314477f8e\\/square.jpg\",\"medium\":\"https:\\/\\/images.tophatter.com\\/7b7b651be4bd666b5750053314477f8e\\/medium.jpg\",\"large\":\"https:\\/\\/images.tophatter.com\\/7b7b651be4bd666b5750053314477f8e\\/large.jpg\",\"original\":\"https:\\/\\/images.tophatter.com\\/7b7b651be4bd666b5750053314477f8e\\/original.jpg\"}]', '0', NULL, '2018-12-05 15:25:20', '2018-12-05 15:25:20', '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, '2018-12-05 10:30:52', '1', '2018-12-05 10:41:49', '1', '1', '2018-12-05 15:24:09', 'log/tophatter/20181205/4.txt', '[http://image-us.bigbuy.win/upload/image/assistant/JM10697/495146dbc52feebf518e3da191443ffc.jpg is not an image]');
until i=n
end repeat;
commit;
set autocommit = 1;
end $$
2、调用
-- 调用
call insert_tophatter_record(1000000);
3、查看存储过程
-- 查看存储过程
show procedure status;
4、删除存储过程
-- 删除存储过程
drop procedure if exists insert_tophatter_record;
5、其他
1.创建函数的时候要先开启mysql创建函数功能,默认是关闭的
查看方式:show variables like ‘%func%’;
开启方式:set global log_bin_trust_function_creators=1;
2.创建函数和存储过程的时候,必须在开始和结束位置添加 DELIMITER $$, $$