DROP PROCEDURE if exists batchInsertContract; delimiter // create procedure batchInsertContract(in loop_time int) begin declare idx int; set idx = 1; while idx <= loop_time do insert into contract(version,api_user_id,date_created,is_deleted,is_synced,last_updated,original_doc_id,pages,status,title,uuid) values (1,1,now(),0,0,now(),1,10,0,'测试合同',(select UUID())); set idx = idx + 1; commit; end while; end; // delimiter ;
delimiter // 把界定符由原来的 ; 符号,改为 //
此存储过程支持 InnerDB 类型表。