create PROCEDURE pwhile()
begin
declare done int default 0;
declare ids int;
declare idCur cursor for select id from t_base_party_organ_copy;
declare continue handler for not found set done = 1;
open idCur;
REPEAT
fetch idCur into ids ;
if not done then
update t_base_party_organ_copy set adress='1'+id where id = ids;
end if;
UNTIL done end repeat;
close idCur;
end;
call pwhile();
drop PROCEDURE pwhile;
参考:https://www.cnblogs.com/silentdoer/p/6274576.html
mysql 存储过程循环
猜你喜欢
转载自blog.csdn.net/qq_35201754/article/details/80326336
今日推荐
周排行