declare Cursor cur is select table_name from all_tables where owner = 'XXX' AND TABLE_NAME LIKE 'I_%'; rs cur%rowtype; begin for rs in cur loop begin execute immediate 'drop table ' || rs.table_name; dbms_output.put_line(rs.table_name); end; end loop; end;
两种方法:第一种是动态sql,第二种是对语句进行处理“select 'delete'||table_name from user_tables”,select出用户所有表名,效果如图: 然后将你需要删除的包含标明的记录复制下来,进行批处理就ok了
Cursor cur is
select table_name
from all_tables
where owner = 'XXX'
AND TABLE_NAME LIKE 'I_%';
rs cur%rowtype;
begin
for rs in cur loop
begin
execute immediate 'drop table ' || rs.table_name;
dbms_output.put_line(rs.table_name);
end;
end loop;
end;
然后将你需要删除的包含标明的记录复制下来,进行批处理就ok了