【Mysql】-- 使用存储过程造数据
1. 定义生产数据的存储过程:
drop procedure if exists prcd_create_data; create procedure prcd_create_data(IN totalCount int) begin declare num int; set num=0; while num<totalCount do set num=num+1; // 加入需要新增数据的sql INSERT INTO `pcl`.`person` (`name`, `age`) VALUES ('周贤贤',num); end while; END
2.调用存储过程:
call prcd_create_data(400000);