Great Deals

Difference between TRUNCATE, DELETE and DROP commands

20:08 suresh chaudhari 0 Comments

 1>TRUNCATE is a DDL command whereas DELETE is a DML command. 2>When compared with delete TRUNCATE is much faster than DELETE.
Because
Step 1:When you DELETE.all the data first gets copied into the Rollback Tablespace first.

2> Then delete operation get performed.
Benefit of delete is  when you  ROLLBACK after deleting a table ,you can get back the data(The system get it for you from the Rollback Tablespace).

But when you type TRUNCATE,it removes data directly no extra copy is maintained .Thats why TRUNCATE is faster.

Once you Truncate you cann't get back the data.

3>You cann'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 cann't use conditions(WHERE clause) in TRUNCATE.But in DELETE you can write conditions using WHERE clause

0 comments:

Advertising