CREATEPROCEDURE `xiaojiaPlus`(IN sum INT) BEGIN DECLARE count INTDEFAULT0; DECLARE i INTDEFAULT0; SET@exesql= concat("INSERT INTO xiaojia(uuid) VALUES"); SET@exedata= ""; SET count =0; SET i =0; WHILE count < sum DO SET@exedata= concat(@exedata, ",(UUID())"); SET count = count +1; SET i = i +1; IF i %1000=0THEN SET@exedata=SUBSTRING( @exedata, 2 ); SET@exesql= concat("INSERT INTO xiaojia(uuid) VALUES", @exedata); PREPARE stmt FROM@exesql; EXECUTE stmt; DEALLOCATEPREPARE stmt; SET@exedata= ""; END IF; END WHILE; IF length( @exedata ) >0THEN SET@exedata=SUBSTRING( @exedata, 2); SET@exesql= concat("INSERT INTO xiaojia(uuid) VALUES", @exedata); PREPARE stmt FROM@exesql; EXECUTE stmt; DEALLOCATEPREPARE stmt; END IF; END;