DELIMITER $
CREATE PROCEDURE insertadd(IN args INT)
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i<=args DO
INSERT INTO person(id,NAME) VALUE (i,CONCAT("孙子昊",i));
SET i=i+1;
END WHILE;
END
$
然后调用此存储过程,给person表中插入1万条数据:
CALL insertadd(10000)
DELIMITER $
CREATE PROCEDURE insertadd(IN args INT)
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i<=args DO
INSERT INTO person(id,NAME) VALUE (i,CONCAT("孙子昊",i));
SET i=i+1;
END WHILE;
END
$
然后调用此存储过程,给person表中插入1万条数据:
CALL insertadd(10000)