diff between DELETE and TRUNCATE?.
Answers were Sorted based on User's Feedback
Delete command is a dml command
truncate command is a ddl command
Delete command has a where clause.
truncate hasn't where clause.
Delete doesn't release memory space(means we can rollback
the deleted rows)
truncate releases memory space(means we can't rollback)
By using synonym we can delete a rows(Delete command).
By using synonym we can't delete a rows(Truncate command).
| Is This Answer Correct ? | 29 Yes | 0 No |
Answer / 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 |
Answer / thirupathi.l
delete is a dml command using this we can getback the records.
it will not call inmplicit commit.
perfomance slow in case of delete no.of records.
truncate is a ddl commnd.itwillcall implicit commit
we can't get back the record
performance good in case of deleting no.of records
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / shree
Delete command always used with where clause.
but Truncate is not.
Delete command deletes only selected rows/records from table
which are defined in where clause.
But Truncate command deletes all records from the Table
without using where clause.
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / ron
To add to ans#1. truncate needs drop table level priviledges.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / shilpa.oracle
Answer given by Manoj is Absolutely correct.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / dhananjay mukhedkar
The Answer given by Prasad Reddi is perfect.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / kumar
DELETE TABLE is a logged operation, so the deletion of each
row gets logged in the transaction log, which makes it
slow.
TRUNCATE TABLE also deletes all the rows in a table, but it
won't log the deletion of each row, instead it logs the
deallocation of the data pages of the table, which makes it
faster.
The records deleted through DELETE can be roll backed.
The records deleted through TRUNCATE can't be roll back.
If we are using TRUNCATE ina Transaction then only we can
do the roll back else not.
Both will delete the data but not the stucture of the table.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / p.baskar
DELETE is DML Command, TRUNCATE is DLL Command.
DElete used to particular record or, all records from table.
But TRUNCATE only relete the all records.
Ee can rollback the DELETE Command, But we cant rollback the
TRUNCATE
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ron
again to add to my earlier positing, many forget that is the
table has materialized view log truncating table will
corrupt the materialized view.
in that case you have to user:
truncate table schema_name.table_name purge materialized views;
you can read more about it here:
http://www.psoug.org/reference/truncate.html
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain what are the advantages of views?
How to put more than 1000 values into an oracle in clause?
What is the parameter mode that can be passed to a procedure?
How to manage transaction isolation level?
What is max rowid in oracle?
How to shutdown your 10g xe server?
WHAT IS ecc 6.0
How would you configure your networking files to connect to a database by the name of DSS which resides in domain icallinc.com?
How to rebuild an index in oracle?
We are using Oracle apps with XML publisher.In that,we are facing some problems while giving a Footer in RTF Template.While giving a footer in RTF Template it is Visible in all the pages,but after the PDF is getiing generated,the Footer are Visible on alternate pages only (like on first page ,third page) and so on. Please provide the Solution for getting the Footer on all the pages.
Define oracle database
What privilege is needed for a user to create views in oracle?