How to delete all data in a table

What's the best way to delete all of the data from a table? I wan't to do a data wipe of our database to eliminate all of the test data we've been putting into it over the last few months.
I've tried using: DELETE FROM TABLENAME; but killed SQL+ after it ran for 13 hours and still wasn't done. There are approximately 900,000 records in this table and I would prefer not to drop/recreate the table because of the various dependencies within the database.
Any suggestions would be appreciated.
Thanks,
Shawn Smiley
Sr Software Developer/Software Architect
xwave New England

Try the TRUNCATE TABLE command. That's quick and easy.
e.g.
TRUNCATE TABLE mytable;

Similar Messages

  • How to delete the data from partition table

    Hi all,
    Am very new to partition concepts in oracle..
    here my question is how to delete the data from partition table.
    is the below query will work ?
    delete from table1 partition (P_2008_1212)
    we have define range partition ...
    or help me how to delete the data from partition table.
    Thanks
    Sree

    874823 wrote:
    delete from table1 partition (P_2008_1212)This approach is wrong - as Andre pointed, this is not how partition tables should be used.
    Oracle supports different structures for data and indexes. A table can be a hash table or index organised table. It can have B+tree index. It can have bitmap indexes. It can be partitioned. Etc.
    How the table implements its structure is a physical design consideration.
    Application code should only deal with the logical data structure. How that data structure is physically implemented has no bearing on application. Does your application need to know what the indexes are and the names of the indexes,in order to use a table? Obviously not. So why then does your application need to know that the table is partitioned?
    When your application code starts referring directly to physical partitions, it needs to know HOW the table is partitioned. It needs to know WHAT partitions to use. It needs to know the names of the partitions. Etc.
    And why? All this means is increased complexity in application code as this code now needs to know and understand the physical data structure. This app code is now more complex, has more moving parts, will have more bugs, and will be more complex to maintain.
    Oracle can take an app SQL and it can determine (based on the predicates of the SQL), which partitions to use and not use for executing that SQL. All done totally transparently. The app does not need to know that the table is even partitioned.
    This is a crucial concept to understand and get right.

  • How to delete some date in target table at a mapping?

    How to delete some date in target table at a mapping?
    I extract date from source tabel into target table,
    but before extract date I want to delete some date from target?
    how to do?

    Just to change a bit of terminology in the reply, within the mapping, click on operator properties and choose TRUNCATE/INSERT.
    Note that truncate is dependent on constraints, so you probably must disable those before doing this. You can of course do DELETE/INSERT...
    Jean-Pierre

  • How to delete all data in all tables in one time ?!

    1 CREATE OR REPLACE PROCEDURE delete_all_data
    2 IS
    3 v_statement VARCHAR2 (200);
    4 BEGIN
    5 FOR i IN (SELECT *
    6 FROM user_tables)
    7 LOOP
    8 v_statement :=
    9 'delete table ' || i.table_name ;
    10 EXECUTE IMMEDIATE v_statement;
    11 END LOOP;
    12 commit;
    13* END;
    SQL> /
    Procedure created.
    SQL> exec delete_all_data
    BEGIN delete_all_data; END;
    ERROR at line 1:
    ORA-00903: invalid table name
    ORA-06512: at "DE2.DELETE_ALL_DATA", line 10
    ORA-06512: at line 1
    I made the previous code , but it's didn't work with me .... any help for this problem please ?!
    I'm just reminder ..... all what I need ,that delete all data in all tables in one time only .
    I'm waiting for the answer ..... and thanks in advance

    create or replace
    FUNCTION TRUNC_SCHEMA RETURN NUMBER AS
    CURSOR select_table IS SELECT TABLE_NAME AS TNAME FROM USER_TABLES ORDER BY 1;
    sTableName Varchar2(128);
    sUser Varchar2(128);
    sConstraintName Varchar2(128);
    plsql_block Varchar2(512);
    BEGIN
    SELECT USER INTO sUser FROM DUAL;
    IF ((sUser='SYSTEM') OR (sUser='SYS')) THEN
    RETURN 1;
    END IF;
    EXECUTE IMMEDIATE 'PURGE RECYCLEBIN';
    -- DISABLE table's constraints
    FOR C1 IN (select CONSTRAINT_NAME, TABLE_NAME from user_constraints where STATUS = 'ENABLED' AND CONSTRAINT_TYPE in ('P','R') ORDER BY R_CONSTRAINT_NAME) LOOP
    sConstraintName := C1.CONSTRAINT_NAME;
    sTableName := C1.TABLE_NAME;
    plsql_block := 'ALTER TABLE ' || sTableName || ' DISABLE CONSTRAINT ' || sConstraintName;
    EXECUTE IMMEDIATE plsql_block ;
    END LOOP;
    FOR D IN select_table LOOP
    --get table name
    sTableName := D.TNAME;
    -- clear table
    plsql_block := 'TRUNCATE TABLE ' || sTableName;
    EXECUTE IMMEDIATE plsql_block ;
    END LOOP;
    -- ENABLE table's constraints
    FOR C2 IN (select CONSTRAINT_NAME, TABLE_NAME from user_constraints where STATUS = 'DISABLED' AND CONSTRAINT_TYPE in ('P','R') ORDER BY R_CONSTRAINT_NAME desc) LOOP
    sConstraintName := C2.CONSTRAINT_NAME;
    sTableName := C2.TABLE_NAME;
    plsql_block := 'ALTER TABLE ' || sTableName || ' ENABLE CONSTRAINT ' || sConstraintName;
    EXECUTE IMMEDIATE plsql_block ;
    END LOOP;
    RETURN 0;
    EXCEPTION WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR: ' || SQLERRM);
    RETURN 1;
    END TRUNC_SCHEMA;
    /

  • How to delete the data in a table using function

    hi all,
    i need to delete the data in a table using four parameters in a function,
    the parameters are passed through shell script.
    How to write the function
    Thanks

    >
    But the only thing is that such function cannot be used in SQL.
    >
    Perhaps you weren't including the use of autonomous transactions?
    CREATE OR REPLACE FUNCTION remove_emp (employee_id NUMBER) RETURN NUMBER AS
    PRAGMA AUTONOMOUS_TRANSACTION;
    tot_emps NUMBER;
    BEGIN
    SELECT COUNT(*) INTO TOT_EMPS FROM EMP3;
    DELETE FROM emp3
    WHERE empno = employee_id;
    COMMIT;
    tot_emps := tot_emps - 1;
    RETURN TOT_EMPS;
    END;
    SQL> SELECT REMOVE_EMP(7499) FROM DUAL;
    REMOVE_EMP(7499)
                  12
    SQL> SELECT REMOVE_EMP(7521) FROM DUAL;
    REMOVE_EMP(7521)
                  11
    SQL> SELECT REMOVE_EMP(7566) FROM DUAL;
    REMOVE_EMP(7566)
                  10
    SQL>

  • Delete all data of a table in Oracle before insert operation in BizTalk.

    Hi,
    I need to delete all the data of a table from Oracle before insert data into it from BizTalk. I can't create stored procedure on the oracle table or how to create a xml of the delete schema of the oracle table in the BizTalk with filter node has a blank
    value because i need to delete all the data of the table so that i will send this xml as delete operation.
    Thanks in advance.
    Regards,
    Gyan

    You need to create two schemas: One for deleting all rows and one for inserting.
    Then combine these Schemas into one and use the "CompositeOperation" SOAP Action Header.
    Something like the below (a SQL Example, so the Schemas needs to be replaced by WCF-Oracle syntax)
    <Request xmlns="http://CompositeTest.CompositeSchema">
    <Delete xmlns="http://schemas.microsoft.com/Sql/2008/05/TableOp/dbo/Employee">
    <Rows>
    <Employee xmlns="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo">
    </Employee>
    </Rows>
    </Delete>
    <Insert xmlns="http://schemas.microsoft.com/Sql/2008/05/TableOp/dbo/Employee">
    <Rows>
    <Employee xmlns="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo">
    <Name>John</Name>
    <Designation>Manager</Designation>
    <Salary>100000</Salary>
    </Employee>
    </Rows>
    </Insert>
    </Request>
    Morten la Cour

  • How to delete select data in the table control

      this problem makes me headache.
      I am new to labview, when  a table shows some data. many rows and column. how can delete on row which I selected. the other rows are remain no change.
    I really need help.thanks in advance. It is better to attach the program.my labview is 2009
    Solved!
    Go to Solution.

    Hi,
    You can do it with a table control as well. Check out the attached VI. To delete a row, Run the VI, just right click the row and click "Delete Row". To get back the default values, click reinitialize.
    Reards,
    NitZ
    (Give Kudos to Good Answers, Mark it as a Solution if your problem is Solved) 
    Attachments:
    Untitled 3.vi ‏8 KB

  • How to print all data in a table?

    Hello!
      I am doing report with VC. Now I want to print data ,The system action "print" can not print all data,only a page in the table  can be printed. Are there any ways to finishe the print function,Can you help me?
    Thank you very much!

    See this how to guide I put together:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/47fe4fef-0d01-0010-6f87-ed8ecb479123

  • BPC 7.5NW : How to delete all data in application

    Hi,
    I need to delete transactional data in an planning application. I've run a "clear" and I clears all the data, but unfortunately, it's "only a delta" delete. So there are still several datapackage request in my application. Of course the sum is zero, but there are still lot's of data.
    How to I do a full delete af all transactional data and request ?
    i need this in order to delete all masterdata and reload it.
    Thank you,
    Joergen Dalby

    Hi,
    Easiest way of complete deletion of transactional data from application is from back end.
    Login into back end(BPC BW) via logon pad
      --Goto tcode RSA1 and click on infoproviders tab
       --Search for Application (from where you want to delete data)
       --Select the application and change from planning mode to data load mode from context menu
       --Select delete data from context menu
         --Select No to keep dimension data
       --Once data deleted from application(infocube) change back planing mode(from context menu)
    hope it works..
    regards,
    Raju

  • How to delete some data from GLPCA table

    Dear Friends,
    We have extracted some data in GLPCA table via the ECPA component. We
    want to delete these records ( Doc type and Posting date is known).
    However we do not want other data already existing the GLPCA to be
    deleted. Is there some Std SAP Trx for deletion of partial/select data
    from EIS tables.
    Please explain us clearaly how we can delete these records.
    Your quick reply for this issue is highly appreciated.
    Thanks & Regards,
    Naveen Kumar.

    Hello,
    Please check the use of the report ZDELETE_PCA_DATA_BUKRS (mentioned in the SAP note 1174360), to delete totals from GLPCT.
    I am not sure of any deletion reports for GLPCA table.
    If you open the Source code of this program, you can see the following information :
    "This report provides a possibility to delete actual and plan
    *& postings on company code level as an alternative for transaction
    *& 0KE1."
    I do not have much information on this report as, personally I haven't used this anytime. Please run in 'Test Run' mode first and look for the results.
    I hope this helps.
    Thanks and regards,
    Suresh Jayanthi.

  • How to delete PSA Data from any Table

    Pls specify the steps to delete PSA Data from any specific table.

    You can delete the PSA requests manually one by one as specified in the previous posts.
    You can also trigger the deletion of PSA periodically by using Process chain.
    'Deletion of PSA request' is the process type that need to be used.
    By this way you can delete all the PSA requests of the table, that are older than certain number of days.
    you can also schedule the PSA deletion for more than one table at a time, by including the tables in the same Process chain.

  • How to delete all data in a file

    Hello.
    I am trying to clear all the data from a file that will be continually replaced with a file of the same name with new data in it.  The goal is to delete the file while going through a while loop.  The problem I am having is with a dialog box popping up asking me if I want to replace the existing data.  I don't want a dialog box to pop up, just for the loop to continuosly delete any information (or to write a null string into the file) while it is looping, even if the file is empty.  At some point, the file will be replaced by actually data, which will cause a case structure to react and trigger the program to begin.
    Attached is the file.
    Thanks for the help!
    Tyler
    Attachments:
    Tyler.zip ‏658 KB

    Hello Tyler,
    now I had a look into your vi and made some comments on it.
    If your vi contains only LV functions you don't need to save as llb with all subVI from lv.lib!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    NewMethod.vi ‏90 KB

  • How to delete all the PSA data in one go

    Hello Guys,
    I want to clear all the data from all the PSA tables at one shot, how can i do this??
    I have tried following things:
    1) I have gone to PSA root node and right click and then clicked on delete PSA data, but its showing me all the datasources and when i am executing that, it is deleting one by one(that i means i need to select individual datasource, which i do not want).
    2) Above specified step runs RSPSADEL1 in background , so i doubt whether it deletes psa data only or complete Table?
    3)I got the info from other posts that there is a fm which is RSATREE_PSA_DELETE_BATCH, but i need to make myself clear whether this fm deletes only data or complete Table?
    I am using sap-bw 3.5.
    Regards,
    Dolly

    Hi,
    there is one easy way to delete data from PSA .You can create a process chain have one delete data from PSA step where you need to give PSA table name and request older than (no of days before which you want to delete data ).
    Execute it and it will delete all the data before specified no of days .You can add multiple PSA tables here and can delete whole data in one go .
    Regards,
    Jaya

  • BPM question - Delete all entries in a table and Insert data

    Hello,
    I'm new to PI BPM and have this scenario to implement.
    I'm supposed to delete all entries in a table and then insert data to the same table.
    Is BPM necessary? If it is, what is the best practice to implement my scenario?
    I want to make sure that all entries were successfully deleted before insert data.
    How do I check if all entries in the table were deleted successfully before
    initiating insert.
    Thank you.
    -Won

    Hi Won,
    Yes, this is possible without BPM.
    You have to create 2 separate mappings, each for deleting & inserting the records.
    You will have 2 different Interface mappings as well.
    But in ID, create a single interface determination.
    In that, configure Deletion interface mapping first and in the second row, configure Insertion interface mapping.
    Please make sure that the parameter 'Mainain Order At runtime' is checked in interface determination.
    -Supriya.

  • How to delete master data of materials from sap tables

    how to delete master data of materials from sap tables...its needed now.
    i know its not recommended but still we need to do this. give me the best possible approach.
    regards,
    suneetha

    Hi,
    I would suggest you not to write your own code to delete the entries.
    BAPI_MATERIAL_DELETE, this would mark all materials selected for deletion. But still the material would exist in SAP.
    Another solution: Delete a material manually and in another session execute the transaction SM04. This would display the tables which get locked when you do the operation, Then you can write your own code to delete the material numbers from all the related tables.
    Regards
    Subramanian

Maybe you are looking for

  • Transfer files from OS 8.6 to OS 10.5 and printer issue

    I am relatively new to the MacOS world, but I am enjoying every minute of it. I recently acquired a new iMac with OS X (10.5) on it. I also have an older Mac that runs OS 8.6 that someone just gave to me. I would love to network the two and share fil

  • MacMini 2012 with multiple monitors?

    Hi folks, I have a Mac Mini 2012 and I'm currently using a Panasonic 720p TV as a monitor via the HDMI port. I've purchsed a HDMI splitter as I want to run a second smaller monitor simultaeneously. Can I use the HDMI to DVI adaptor and run a DVI Moni

  • Copying photos to an xd card from iphoto 08

    How do I copy photos from iphoto 08 (ver 71) to an xd card for use in a digital picture frame?

  • Making a US account to download ps4 games...?

    Just wondering if this is allowed? or will it be patched ?  as curretly there is a offer of £8 for the last of us remastered digital code but it will only work on a US account...

  • Process to find out tables & functional module

    Hi, I would like to know the process to find out tables for configured objects not the master data objects and also the process for finding a functional module for particular application like action. regards Srinath