What is the difference between DELETE and TRUNCATE?

Answer Posted / brajendra arzare

Deletes perform normal DML. That is, they take locks on
rows, they generate redo and they require segments in the
UNDO tablespace. Deletes clear records out of blocks
carefully. If a mistake is made a rollback can be issued to
restore the records prior to a commit.
Truncates are DDL and truncate moves the High Water Mark
of the table back to zero. No row-level locks are taken, no
redo or rollback is generated.so they have the same effect
as a delete, but without all the overhead. Just one slight
problem: a truncate is a DDL command, so you can't roll it
back if you decide you made a mistake. (It's also true that
you can't selectively truncate -no "WHERE" clause is
permitted, unlike with deletes, of course).

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why select is used in sql?

518


What is parallel hint?

749


Explain correlated query work?

596


How does a self join work?

516


how can we repair a mysql table? : Sql dba

540






How do I start sql from command line?

533


What is online transaction processing (oltp)?

600


what is index? : Sql dba

558


define sql insert statement ? : Sql dba

550


How to create an array in pl/sql?

584


What is trigger types in sql?

535


explain the difference between delete , truncate and drop commands? : Sql dba

548


Is sql between inclusive?

590


How do you optimize a stored procedure query?

566


what is a cursor? : Sql dba

557