views:

60

answers:

3

i want to delete all the data rows in the table. but without dropping the table. delete statement has a where clause so i have to give one by one for each row. is there any other way of deleting the whole data rows in the table.

this is Oracle and using sqlplus

+2  A: 

You can try: TRUNCATE TABLE tableName

Klinger
A: 
Truncate Table tablename

http://www.orafaq.com/faq/difference_between_truncate_delete_and_drop_commands

You can delete all records with delete from tablename also but truncate is much faster

klabranche
I was just about to post this link. :-)
Klinger
how to truncate when we have foreign keys. can someone help me
Nubkadiya
klabranche
in drop table there is something called cascase constraints. dont truncate have the same
Nubkadiya
+1  A: 

It will be better that you drop constraint and then use Truncate command and after getting rid of data , apply the constraint again.

Muhammad Ikram

related questions