在项目中处理一些数据A表的中文名需要转成B表字典表中对应的编码
例子
begin
for cur in (
select * from dual
)loop
update TABLEA set A = cur.A where B = cur.B;
end loop;
end;
实际应用
--市
begin
for cur in (
select AREA_ID, replace(NAME, '市' , '') NAME from GHGL_UTIL_XMZ_AREA where type = 'city'
)loop
update GHGL_DYJR_FDTZGL set AREA = cur.AREA_ID where AREA = cur.NAME;
end loop;
end;
--区县
begin
for cur in (
select AREA_ID, NAME from GHGL_UTIL_XMZ_AREA where type = 'county'
)loop
update GHGL_DYJR_FDTZGL set CITY = cur.AREA_ID where CITY = cur.NAME;
end loop;
end;