–批量对符合条件的表记录进行更新
–aa代表查询出的符合条件数据的别名
–aa后的表示需要符合的条件
–loop后开始写更新操作
begin
for aa in (select t.district_code,d.gbcode from t_s_organizations_new t left join t_s_district d on t.district_code = d.ename) loop
update t_s_organizations_new t
set t.district_code = aa.gbcode
where t.district_code = aa.district_code;
end loop;
end;
借鉴于:
https://blog.csdn.net/weixin_30952535/article/details/98339377