diff between DELETE and TRUNCATE?.

Answer Posted / pr@$@d

1 TRUNCATE is a DDL command whereas DELETE is a DML command.
2 TRUNCATE is much faster than DELETE.
Reason:
a) When you type DELETE. All the data get copied into
the Rollback Table space first. Then delete operation get
performed. That’s why when you type ROLLBACK after deleting
a table, you can get back the data (The system gets it for
you from the Rollback Table space).All this process takes
time. But when you type TRUNCATE, it removes data directly
without copying it into the Rollback Tablespace.Thatswhy
TRUNCATE is faster. Once you truncate you can’t get back
the data.
b) TRUNCATE command resets the High Water Mark for the
table but DELETE does not. So after TRUNCATE the
operations on table are much faster.
3 You can’t rollback in TRUNCATE but in DELETE you can
rollback. TRUNCATE removes the record permanently.
4 In case of TRUNCATE, Trigger doesn't get fired.But in DML
commands like DELETE .Trigger get fired.
5 You can’t use conditions (WHERE clause) in TRUNCATE.But
in DELETE you can write conditions using WHERE clause

Regards,
-Pr@$@d Reddi.
prasadreddi_mca@yahoo.com

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does one get the view definition of fixed views/tables?

789


What is a table in oracle?

708


How to export several tables together?

775


How to load excel data sheet to oracle database

753


What is varray?

776


How to connect to the server with user account: sys?

763


Explain alias?

888


What are the general rules on data consistency?

752


What is integrity and what is constraint??Explain with example

1957


Explain the importance of .pll extension in oracle?

746


Point the difference between translate and replace?

813


What do you mean by a database transaction & what all tcl statements are available in oracle?

759


How to write date and time literals in oracle?

732


How different is ms access and oracle?

759


How to pass parameters to procedures in oracle?

795