create procedure dowhile() /SQL的循环要放到存储过程里面才可以执行/
BEGIN
declare i int;
set i=118;
start transaction;
while i<120 DO
INSERT INTO tra_train_enter(trainID,userId,type,status,createTime,createUser,updateUser,updateTime,conditionFileName,conditionFilePath,version,message,idCardScanFileName,workTimeFileName,idCardScanFilePath,workTimeFilePath,conditionStatus,idCardStatus,workTimeStatus,conditionHtmlPath,idCardHtmlPath,workTimeHtmlPath)
values(219,concat(i),1,2,‘2019-04-01 14:06:00’,concat(i),concat(i),‘2019-04-01 14:06:00’,Null,Null,0,‘通过’,Null,Null,Null,Null,0,0,0,Null,Null,Null);
set i=i+1;
end WHILE;
commit;
end;
call dowhile(); /创建了存储过程后用call来执行/
DROP PROCEDURE dowhile /删除存储过程/