mysql 循环insert

DELIMITER #

CREATE PROCEDURE test_insert() 
BEGIN 
DECLARE i INT DEFAULT 1;
WHILE i<=100
DO 
insert into books(bid,bname,author,price,book_number,layout,discovery_unit,type,binding,date,stock) VALUES(null,'越孤独越自由','傅踢踢','39','9787550024205',null,'百花洲文艺出版社','文学','平装','2017-10-1','150');
SET i=i+1; 
END WHILE ; 
commit; 
END #

 


call test_insert() 

你可能感兴趣的:(mysql 循环insert)