delimiter $$;
drop procedure if exists InsertValueWithWhile;
create procedure InsertValueWithWhile()
BEGIN
declare i int default 0;
while (i<610)
do
PREPARE stmt1 FROM
'insert into ten_uar2 select reputations,a_nums from (select concat(?,''-'',?) as reputations,sum(a_num_aver) as a_nums from (select * from uar2 limit ?,?) as a) as b';
SET @a = i+1;
SET @b = i+10;
SET @c = i;
SET @d = i+9;
EXECUTE stmt1 USING @a,@b,@c,@d;
set i=i+1;
end while;
end $$;
DELIMITER;