开发者

How to delete all the data from the table in sqlplus oracle

开发者 https://www.devze.com 2023-01-04 02:10 出处:网络
I want to delete all the data rows in the table, but without dropping the table. The delete statement has a where clause so I have to give one by one for each row. Is there any other way of deleting t

I want to delete all the data rows in the table, but without dropping the table. The 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开发者_JAVA技巧 sqlplus


You can try: TRUNCATE TABLE tableName


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


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


Try out Bulk deletion using FORALL. In that instead of deleting one row at time an entire bulk can be deleted in a single delete transaction.

0

精彩评论

暂无评论...
验证码 换一张
取 消