This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes Delete Vs Truncate Vs Drop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Delete Vs Truncate Vs Drop" Watch "Delete Vs Truncate Vs Drop" New topic
Author

Delete Vs Truncate Vs Drop

priyanaka jaiswal
Ranch Hand

Joined: Jun 03, 2011
Posts: 79
Hi,


Difference between Delete,Truncate and Drop is


Delete is DML statetment.it only removes the data from table and can use WHERE Clause with it and it can be rolled back.
Truncate is DDL statement .This command delete data from the table .but leaves table structure for future use.It cannot be rolled back
.
Drop is DDL statement .It removes the table from data dictionary and as well drop the storage held by this table.It cannot be rolled back...

am i correct or missing something ,then please correct me...

Thanks in advance
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

It's roughly correct.

TRUNCATE can be used on a single partition too (if you have a partitioned table). And since it is a DDL operation, it doesn't need to generate any undo, which makes it a very fast operation even for tables containing millions of rows.

Since Oracle 10, it is possible to undo a DROP TABLE statement (not TRUNCATE though). If you're interested, see Oracle Flashback Technology.
priyanaka jaiswal
Ranch Hand

Joined: Jun 03, 2011
Posts: 79
Thank you Martin
 
Don't get me started about those stupid light bulbs.
 
subject: Delete Vs Truncate Vs Drop
 
Similar Threads
oracle database purging
JDBC
DELETE statement deletes record but returns 0
Problem in updating/deleting data from MS Access Database
commit command