oracle中批量删除xxx开头表的数据和批量修改以xx开头字段的值

1.批量修改以xxx为前缀名的表名

       declare
            begin
                for vcur in (select t.TABLE_NAME
                          from user_tables t
                             where t.TABLE_NAME like 'xxx_%') loop
                               execute immediate 'drop table '||vcur.table_name;
           end loop;
     end;

2.批量修改一张表中以xxx开头的字段的值

declare
                b varchar2(35);
 begin
   for i in (select idx_code from rplm_index_lib where dr!='1') loop
        b := 'ZBK01_'||substr(i.idx_code,12,4);
       update rplm_index_lib  SET IDX_CODE = b where idx_code = i.idx_code;
        commit;
  end loop;
end;

猜你喜欢

转载自blog.csdn.net/qq_31647257/article/details/81625307