---
title: "mysql存储过程"
author: "香水浓"
date: "2015-05-24T04:42:24Z"
tags: ["MySQL"]
categories: ["数据库"]
slug: "mysql"
draft: false
lastmod: "2015-05-24T04:42:24Z"
id: 2213778
url: "https://794818247.iteye.com/blog/2213778"
---

Description:插入大量测试数据

```java
use xmpl;

drop procedure if exists mockup_test_data_sp;

create procedure mockup_test_data_sp(
	in number_of_records int
)
begin
	declare cnt int;
	declare name varchar(20) default 'test';
	set cnt = 1;
	
	while cnt <= number_of_records do
		insert into secondary_test_tbl(name) values (concat('aaa', '-', cnt));
		set cnt = cnt + 1;
	end while;
end;
```

call mockup_test_data_sp(200000);