Snowfun

导航

 

select * from mid_city   --贫困县及省表

select code,censusaddr from bd_psndoc --人员表户籍地址字段

 

declare
  --v_count int(4);
  v_sql varchar2(1000);
  begin
     for c_cur in(
       select replace(country,'') c_country from mid_city where length(country) >2
       union all
       select country from mid_city where length(country) <=2
       )
       loop 
        v_sql := 'update bd_psndoc set is_flag=''Y'' where censusaddr like ''%'||c_cur.c_country||'%''';
        dbms_output.put_line(v_sql);
        execute immediate v_sql;
        --commit;
       end loop;

       update bd_psndoc set is_flag='N' where is_flag is null;
       commit;
       end;

 

 

posted on 2018-09-28 15:06  Snowfun  阅读(100)  评论(0编辑  收藏  举报