If you are completely sure of what you are doing, that is, if you are sure that it is not by chance that you select a table that you do not want to discard, you can do the following:
set serveroutput on size 1000000
begin
for r in (
select table_name
from user_tables
where table_name like '%\_COMMON' escape '\')
loop
execute immediate 'drop table ' || r.table_name;
end loop;
exception when others then
dbms_output.put_line(sqlerrm);
end;
/
Edit :
- Changed Now choose from
user_tablesinstead dba_tables, as it seems more secure. - Added
set serveroutput onfor print.dbms_output.put_line - Added
begin .. exception .. endto display errors.
source
share