Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: dropping a large number of tables?

Re: dropping a large number of tables?

From: Nick Butcher <nickb_at_btinternet.com>
Date: 1998/10/28
Message-ID: <3636F8F5.215@btinternet.com>#1/1

Try this:

DECLARE   cursor_name INTEGER;
  run_job INTEGER;

BEGIN   cursor_name := DBMS_SQL.OPEN_CURSOR;

  FOR i IN (SELECT table_name

              FROM user_tables
              WHERE table_name LIKE 'mytable_%') LOOP

    DBMS_SQL.PARSE (cursor_name,
                   'DROP TABLE '||i.table_name,
                    DBMS_SQL.V7);

    run_job := DBMS_SQL.EXECUTE (cursor_name);

  END LOOP;   DBMS_SQL.CLOSE_CURSOR (cursor_name);

END;
/

Much neater

Regards

Nick Butcher Received on Wed Oct 28 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US