Friday, January 7, 2011

Delete, Drop and Truncate Difference

The first difference between
delete, drop and truncate

statements is the statement nature itself. DELETE statement is a DML (DATA MANIPULATION LANGUAGE) statement. DROP AND truncate statements are DDL ( DATA definition language) statements.


A DML action can be rolledback if the data is not committed. Whereas all the DDL actions cannot be rolled back until Oracle 9i. But with Oracle 9i FLASH BACK enabled even some of the DDL statements can be rolledback.


Delete : A delete statement deletes the data from a table. A delete statement can have a where clause, on which it deletes the records that satisfy only the “where” condition.

If the “where” condition is omitted the delete statement deletes all the records in a table.

Actions of Delete statement :

* deletes the data from the current table space

* Modifies the undo tablespace with the delete records.

* Executes all the before / after statement and row level triggers.

* Updates the indexes (makes the index empty if the where clause is omitted).

* Constraint checks are performed before deleting the rows

No comments:

Post a Comment