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;
本文介绍两种批量操作Oracle数据库的方法:一是通过PL/SQL脚本批量删除带有特定前缀的表;二是更新表中符合指定条件的字段值。这两种方法能够显著提高数据库管理效率。

1289

被折叠的 条评论
为什么被折叠?



