Home » SQL & PL/SQL » SQL & PL/SQL » how to delete all record in the table?
icon5.gif  how to delete all record in the table? [message #247121] Sun, 24 June 2007 06:46 Go to next message
Messages: 64
Registered: November 2005
I would like to know, what command to delete all record in the table?

I am little confuse between command to delete the table and command to delete the record in the table..
Re: how to delete all record in the table? [message #247122 is a reply to message #247121] Sun, 24 June 2007 07:16 Go to previous message
Messages: 619
Registered: July 2006
Senior Member
1. Just to delete the data ( rows );

DELETE FROM <table_name>;

2. If no foreign key exists referencing the table and you don't have triggers attached to it - you can use also:

TRUNCATE TABLE <table_name>;

Truncate is DDL command, so it's already has an implied commit.

Both above mentioned commands delete the data, but table definition remains intact.

3. To "delete" table (incuding table definitions) you can use:
DROP TABLE <table_name>;

It's also DDL, so no commit is necessary.


Previous Topic: REGEXP - ignore spaces
Next Topic: Delete file from UNIX box through PL/SQL block.
Goto Forum:

Current Time: Tue Aug 22 04:23:15 CDT 2017

Total time taken to generate the page: 0.10035 seconds