oracle sqlplus中如何删除表中的所有数据
我想删除表中的所有数据行,但不删除表。删除语句有一个 where 子句,所以我必须为每一行一一给出。有没有其他方法可以删除表中的整个数据行?
这是 Oracle
并使用 sqlplus
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 sqlplus
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以尝试:
TRUNCATE TABLE 表名
You can try:
TRUNCATE TABLE tableName
http://www.orafaq.com/faq/difference_ Between_truncate_delete_and_drop_commands
您可以使用<删除所有记录code>delete from 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.
尝试使用 FORALL 进行批量删除。这样,可以在单个删除事务中删除整批数据,而不是一次删除一行。
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.