Drop multiple tables

Hi
Can you pls help me on this
I have 300 tables starting 'ABC_' and I would like to drop all these table starting with this
drop table select table_name from all_tables where table_name like '%ABC_%'but the above query is not working,pls help me on this
Thanks a lot

If you are using Oracle 10 or later, don't forget that you need to use the 'purge' keyword to release the space.
Personally I don't like doing destructive tasks like this through an execute immediate loop - it is better to see and be sure exactly what is going to be removed.
My preferred option would be to generate a script and review it before running - along the lines of:
set verify off trimspool on
spool drop_script.sql
select 'spool drop_script.log' from dual;
select 'set echo on' from dual;
select 'drop table '||owner||'.'||table_name||' purge;'
from all_tables where table_name like '%ABC_%' ;
select 'spool off' from dual;
spool off

Similar Messages

  • How to drop multiple tables in one statement

    I could used to run the below syntax to drop multiple tables in MS SQL, but it doesn't work in Oracle seems like, I am using free Oracle SQL Developer. Not a big deal but wanna know if this can be done. Thanks,
    DROP TABLE A, B, C, D, F

    I'm not so sure in 1 select statement is it possible or not but you can try to use in this manner to see what happens ->
    drop table &tab;
    Enter value for tab: A
    Table A Successfully dropped.
    Enter value for tab: B
    Table B Successfully dropped.Regards.
    Satyaki De.

  • How to drop multiple tables in SQL Workshop

    Hi,
    I'd like to drop multiple tables in one time but
    SQL command processor returnes error message: ORA-00933.
    Could you please tell me how to drop multiple tables in
    one time?
    My trial was follows
    Drop table "table1", "table2"
    Result
    ORA-00933: SQL command not properly ended
    Regards,
    Hideki Sakamoto

    Hideki,
    SQL syntax permits you to specify only one table in a DROP TABLE command.
    The SQL Command Processor permits you to run one statement or PL/SQL block per submission.
    So there are at least two ways you can do this. You could either upload or create a SQL script in SQL Workshop which contains your multiple statements:
    drop table "table1"
    drop table "table2"
    or you could execute a single anonymous PL/SQL block in the SQL Command Processor, as in:
    begin
    execute immediate 'drop table "table1"';
    execute immediate 'drop table "table2"';
    end;
    Joel

  • Dropping multiple tables

    how to drop multiple table starting with the word say:FLOW?

    Hi ,
    What about inserting drop table commands in a single file and execute it using SQL*PLUS...?????
    Alternatively , you can see this one....
    Re: drop a list of tables
    Regards,
    Simon

  • Dropping multiple tables in SQL Developer 1.1.25

    HI all
    I am trying to drop multiple tables simultaneously from tha schema but I am unable to find any such option. My host end database in Oracle 9.2.0 and client on Win XP.
    Thanks!
    Ankur

    Hi Ankur,
    Currently that's not possible. It is requested on the SQL Developer Exchange though. If you go vote there, you'll be adding more weight to the feature, so it will be implemented sooner.
    K.

  • Dropping multiple tables having common prefix in SQL Server 2000/2005

    Hi
    I used the below to drop tables having common prefix like 'GPN'
    DECLARE @id varchar(255) DECLARE @dropCommand varchar(255) DECLARE tableCursor CURSOR FOR SELECT name FROM sys.tables WHERE NAME LIKE 'GPN%' OPEN tableCursor FETCH next FROM tableCursor INTO @id WHILE @@fetch_status=0 BEGIN SET @dropcommand = N'drop table ' + @id EXECUTE(@dropcommand) FETCH next FROM tableCursor INTO @id END CLOSE tableCursor DEALLOCATE tableCursor
    The point is this works in SQL2005 but not in SQL2000
    In SQL 2000 we get errors like
    Server: Msg 137, Level 15, State 1, Line 2
    Must declare the variable '@dropcommand'.
    Server: Msg 137, Level 15, State 1, Line 2
    Must declare the variable '@dropcommand'.
    Tried the following as well : SELECT table_name FROM Information_Schema.TABLES WHERE table_name LIKE
    but ended up with the same error.
    Please let me know where i am going wrong and how i can correct it
    Purushothama

    Hi.
    As far as I know SQLS2000 uses syntax:
    EXEC sp_executesql @dropcommand
    Isn't this a problem?
    Talerod

  • FOR XML to generate dynamic script to drop multiple tables

    Log_Table has a column named Col1 where we have table names
    Col1
    TableA1
    TableA2
    TableA3
    TableB1
    TableC1
    TableC2
    Generate dynamic script to drop tables that are in Log_Table and starts with TableA.
    Instead of using the loop, use For XML

    Thanks Visakh16 [+1],
    you are right there was typo mistake :-) I forgot the variable in the end, and Thanks Naomi [+1],
    this is true and better to use quotename or just add brackets. Actually I will not choose this approach since we chould use schema as well. the DDL in the OP is not something that I will create probably.
    In any case, here is the fixed query (current approach):
    declare @SQLString NVARCHAR(MAX)
    SELECT
    @SQLString = (select
    N'IF OBJECT_ID (N''' + CAST([Col1] AS VARCHAR(MAX)) + N''') IS NOT NULL drop table [' + CAST([Col1] AS VARCHAR(MAX)) + N']; '
    FROM Log_Table
    WHERE (Col1 like 'TableA%')
    FOR XML PATH (''))
    --print @SQLString
    EXECUTE sp_executesql @SQLString
    GO
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Drop table for multiple tables

    Hi All,
    I want to drop multiple tables in one drop statement.
    Can it be possible?
    Thanks in advance!!
    SA

    Hi,
    CASCADE CONSTRAINTS must be taken into account. E.g.,
    set pages 0
    spool c:\windows\temp\drop.sql
    select 'DROP TABLE '||TABLE_NAME || ' CASCADE CONSTRAINTS;' from user_tables WHERE table_name like 'ZTEST%';
    spool off
    @c:\windows\temp\drop.sqlHere is a test case:
    SQL> set echo off
    SQL> create table ztest1 (ff NUMBER PRIMARY KEY);
    Table created
    SQL> insert into ztest1 select 1 from dual;
    1 row inserted
    SQL> create table ztest2 (gg NUMBER, constraint gg_fk foreign key (gg) references ztest1(ff));
    Table created
    SQL> insert into ztest2 select 1 from dual;
    1 row inserted
    SQL> drop table ztest1;
    drop table ztest1
    ORA-02449: unique/primary keys in table referenced by foreign keys
    SQL>
    SQL> set pages 0
    SQL> spool c:\windows\temp\drop.sql
    Started spooling to c:\windows\temp\drop.sql
    SQL> select 'DROP TABLE '||TABLE_NAME || ' CASCADE CONSTRAINTS;' from user_tables WHERE table_name like 'ZTEST%';
    DROP TABLE ZTEST1 CASCADE CONSTRAINTS;
    DROP TABLE ZTEST2 CASCADE CONSTRAINTS;
    SQL> spool off
    Stopped spooling to c:\windows\temp\drop.sql
    SQL> @c:\windows\temp\drop.sql
    SQL> DROP TABLE ZTEST1 CASCADE CONSTRAINTS;
    Table dropped
    SQL> DROP TABLE ZTEST2 CASCADE CONSTRAINTS;
    Table dropped
    SQL>

  • Change the display of the multiple Table items using a single Drop-down

    I have created a Web Template in BEx WAD (BW 3.5) with 4 Tables assigned to 4 dfferent Queries. Now I want to change the display of the all the Four Tables based on the selection of display properties chosen in a single Dropdown item. The properties to be selected  in the dropdown are like changing the Alternate style display of Rows, Suppress Alternate Style, Display only 30 Rows or 60 Rows.
    Please help me in writing the script necessary to pass the command from the dropdown to all the Tables to get the desired output.
    Thanks,
    Krishna
    Edited by: Hari Krishna Velampalli on Oct 26, 2008 12:00 AM

    Dipika, Thanks for the response.
    I tried using that option but again since we cannot give custom options in a drop-down,
    I created a Form with a drop-down list of options like Suppress Result Rows, Suppress alternate style of rows, Display only 30 Rows, Display only 100 rows .. and so on.
    Now I am able to change the display of my first table by selecting the options in the drop-down list. But my intention is to apply that selection to Multiple Tables.
    How can I achieve that?
    HK

  • In ADF how can i insert data in multiple table if they have foreign key

    I have started working on ADF and can anybody inform me in ADF how can i insert data in multiple table if they have foreign key,please?
    Thnak you very much.

    Hello,
    Still no luck.I am surely doing silly mistakes.Anyway,Here are my workings-
    1> student_mst (id(pk),studentname) and student_guard_mst(id(fk),guardianname)
    2> created EO from both of the tables,made id in both EO as DBSequence and an association was also generated.
    3> i made that association composite by clicking the checkbox
    4> i created 2 VO from 2 EO.
    5> put those VO in Application Module.
    6> dragged and dropped 2 VO on my jspx page and dropped them as ADF Form.
    Now what to do please?

  • Joining multiple tables in ssis

    I have to join multiple tables like 10 of them and load the data into destination. I get like 66 million records after joining, I have tried two ways to joining and load the data. First way, I used SQL command in ole db source and wrote the query there but
    this is taking forever to start, second way is used sort and merge join transformation and also used Issorted property where ever I can but as it requires multiple sort transformation it is time consuming.
    Is there any other way I can load those 66 million records in less time??
    Thanks,
    sree

    Hi sree,
    If you want to load 66 million records to a SQL server database, the OLE DB Destination Editor allows us to choose either “Table or view” or “Table or view-fast load” from a drop down if data access mode is Table or View. “Table or view-fast load” is the
    fastest way to load data to destination. It internally uses the bulk insert statement to send data into the destination table.
    Besides, SSIS relies heavily on buffer. A set of records are read into the buffer, and from buffer they are written to the destination. So we can change two properties DefaultMaxBufferRows and DefaultMaxBufferSize to improve the performance. Also we can
    add Conditional Split Transformation build some parallelism into the common data flow that directly load data to OLE DB Destination.
    Reference:
    http://henkvandervalk.com/speeding-up-ssis-bulk-inserts-into-sql-server
    http://svangasql.wordpress.com/2012/04/10/simple-tips-to-speed-up-your-ssis-data-flow/
    http://www.developer.com/db/top-10-methods-to-improve-etl-performance-using-ssis.html
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Dropping the tables

    Hi,
    I wants to drop the selected tables from a user (eg:select table_name from user_tables where table_name like 'C%'). I created a temp table and inserted the selected table names.I need a procedure to drop all the tables.
    suppose if table does not exist at the time of dropping it should continue dropping other tables.
    can any one help me?
    Thanks & regards,
    Balaji tk.

    Balaji,
    I could see multiple issues with this code, i have corrected few in the code below.....since i dont have oracle in my system right now......rest you can trace and resolve, then tell us clearly the issue.But i m sure, the issue you are getting is due to some other error
    CREATE OR REPLACE PROCEDURE Delete_Tables
    IS
    TYPE v_tables_temp IS TABLE OF varchar2 INDEX BY BINARY_INTEGER;
    --TYPE v_tables_temp IS TABLE OF temp.table_name%TYPE INDEX BY BINARY_INTEGER;
    v_tables v_tables_temp;
    v_temp temp.table_name%TYPE;
    cursor c is
    SELECT table_name
    FROM user_tables
    WHERE table_name = v_tables(v_Index);
    BEGIN
    SELECT table_name bulk collect
    --SELECT table_name
    INTO v_tables
    --FROM temp;;
    FROM temp;
    open c;
    FOR v_Index IN 1..v_tables.COUNT
    LOOP
    fetch c into v_temp;
    if (c%FOUND) then
    EXECUTE IMMEDIATE 'Drop table v_tables(v_Index)';
    --EXECUTE IMMEDIATE 'Delete from temp where table_name=v_tables(v_Index)';
    end if;
    --else
    EXECUTE IMMEDIATE 'Delete from temp where table_name = v_tables(v_Index)';
    commit;
    END LOOP;
    close c;
    ENDCompare this with your code, and find the error u had in the code !!!
    also grant direct DROP privelege to the table, and not through any role

  • Resource configuration for updating multiple tables

    Hi all,
    My aim is to update multiple tables in Sun Identity Manager
    I would like to know what is the resource to be configured for this
    Could any one help me in solving this issue
    Thanks in advance,
    Shalini

    I have used the Scripted JBDC resource as follows;
    go to Resources > Configure Types and select Scripted JDBC > Save
    at Resources, select resource Type Actions > New Resource
    select Scripted JDBC from the drop down, this should start the wizard
    the wizard will guide you with lots of questions.
    The one problem we had is in the Action Scripts (second wizard page). we found the example scripts
    at the webserver root /idm/sample/ScriptedJdbc/SimpleTable/beanshell
    the above scripts had to be modified to the SQL required for the application, but it worked well with the example databases and codes that it is easily understood.
    there are several examples of different table types here... there are lots of options, see the README iles for each type
    hope this helps;
    TG

  • Unload multiple tables

    Is there a way to unload multiple tables from Apex? I need to download multiple tables and am trying to figure out a way to do it without doing it one by one. I saw a thread from a few months ago but did not see any replies. Did anyone figure this out?
    Thanks.

    create a package in PL SQL within your application
    Script it using PL SQL to eather drop or truncate the tables depending on how you are loading the data
    call the package from the app
    buttons are as good a way as any

  • Migration - dropping multiple objects from captured database

    Hi,
    I am doing some migrations from MSSQL to Oracle using SQL Developer. So far I have found it to be a great tool and very useful.
    However one area I can't seem to figure out is the step between capturing the database and converting it to the Oracle schema. I have captured my MSSQL database and can view it in the "Captured Objects" window - at this point there are a number of objects (e.g. tables and views) that I ether need to drop or rename. I can click on each one individually and do this, but this takes time and is rather laborious. If I multi-select some objects the option to drop the object disappears. Is there some way to drop multiple objects?
    Ideally I'd like to be able to open up a SQL Worksheet and point it at the captured database so I could manipulate the objects with SQL, is that possible? (I could not see a way of doing it).
    Thanks in advance.

    Hi;
    What is DB version? Is there any additional info at alert.log?
    Please see:
    Error ORA-29533 or ORA-29537 When Loading a Java Class File into the Database. [ID 98786.1]
    Regard
    Helios

Maybe you are looking for

  • Missing eData, eSubmit, eAnalyze menus in Excel 2007

    Hi, I've got a strange issue with two of my 7.5 appsets. When I log into the Excel Interface there are no menus for eData, eAnalyze or eSubmit. The Data Manager option is on the eTools menu but selecting it only gives me an Action Pane with "Data Man

  • Linked PDF files won't open in Preview

    I have a a few Table of Content PDF files linked to a large number of PDF files in subdirectories (the old AGES library system).  When I try to open the linked file in Preview i get an error saying that I don't have permission to open this file.  Ado

  • What's the best game builder

    What's the best game builder for mac that will produce game that can be embed on my website?

  • Problems sending files throught TCP sockets

    I would like to transfer a file throught a tcp socket, here there is what the sender program does : try{      File localFile = new File("shared/"+fileName);      DataOutputStream oos = new DataOutputStream(socket.getOutputStream());           DataInp

  • FTPS question.

    Hi, If I use a FTPS connection to get a file in a server I need the FTPS only in the server that I use to get the file or I need in both servers the FTPS connection? Thanks for the help!