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 存储过程循环
最新推荐文章于 2024-03-20 18:01:53 发布