Quantcast
Channel: Question and Answer » oracle
Viewing all articles
Browse latest Browse all 717

Most efficient way to perform table operations (spec. drop) on tables having table names that match a certain criteria

$
0
0

I am performing a schema dump of certain tables. This accompanied by dropping the tables that will be dumped. For example I need to drop all tables that start with, let’s say, “SRC_”. You guys think of a more efficient way of dropping those tables than the script below? Thanks.

begin
  for rec in (select TABLE_NAME
                from ALL_TABLES
               where TABLE_NAME like 'SRC|_%' escape '|'
                 and OWNER = 'SOME_SCHEMA')
  loop
    execute immediate 'drop table ' || rec.TABLE_NAME;
  end loop;
end;
/

Viewing all articles
Browse latest Browse all 717

Trending Articles