Mysql-stored procedure-batch increase data

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,' Test Contract ' ,( select UUID()));
         set idx = idx +  1 ;
         commit ;
      ​​end  while ;
 end ;
 // 
delimiter ;

 

 

delimiter // Change the delimiter from the original ; symbol to //

This stored procedure supports InnerDB type tables.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324853457&siteId=291194637