oracle怎么批量删除表

2023-04-12 04:39:00 oracle 删除 批量

如何批量删除表

有时候我们需要删除大量的表,这时候可以使用oracle的脚本来实现。

方法一:

在sqlplus中运行以下脚本

begin

for c in (select table_name from user_tables)

loop

execute immediate 'drop table '||c.table_name||' cascade constraints purge';

end loop;

end;

/

方法二:

使用系统管理员权限,在sqlplus中运行以下脚本

begin

for c in (select table_name from dba_tables where owner='用户名')

loop

execute immediate 'drop table '||c.table_name||' cascade constraints purge';

end loop;

end;

/

相关文章