mysql存储过程

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

你可能感兴趣的:(mysql)