CREATE PROCEDURE `temp_test`()
begin
declare a int;
declare b int;
declare c int;
declare cur1 CURSOR for select aid from t_test;
declare continue handler for not found set b = 1;
open cur1;
set b = 0;
set c = 1000;
while b = 0 do
fetch cur1 into a;
update t_test set name = c where aid = a;
set c = c+ 1;
end while;
close cur1;
end;
begin
declare a int;
declare b int;
declare c int;
declare cur1 CURSOR for select aid from t_test;
declare continue handler for not found set b = 1;
open cur1;
set b = 0;
set c = 1000;
while b = 0 do
fetch cur1 into a;
update t_test set name = c where aid = a;
set c = c+ 1;
end while;
close cur1;
end;