ITeye博客

mysql存储过程

香水浓 · 2015-05-24 04:42 · mysql · 数据库 · MySQL · Markdown

Description:插入大量测试数据

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);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。