[数据库开发过程中经常会遇到需要批量插入数据的问题,比如:需要对一个文件执行解析入库的操作;本文以Mybatis的foreach为例,(假定Mybatis环境已经配置好)向MySQL中批
[DROP PROCEDURE dowhile; create PROCEDURE dowhile() BEGIN DECLARE i int DEFAULT 0; START TRANSACTION;--定义事务 WHILE i<100 DO
DROP PROCEDURE if exists test_insert ;
DELIMITER ;;
CREATE PROCEDURE test_insert ()
BEGIN
DECLARE i INT DEFAULT 1;# can not be 0
WHILE i<1000
DO
insert into SS_BOOK values (i, CONCAT("00000",i) , CONCAT('book',i), 1, CONCAT('book_description',i));
SET i=i+1;
END WHILE ;
commit;
END;;
CALL test_insert();
[create table t1(sid int not null primary key,sname varchar(1000) not null)engine=innodb default charset=gbk; DELIMITER //create PROCEDURE proc1()BEGIN DE