Thursday, 11 July 2013

What is the difference between delete and truncate command in ORACLE or SQL?



Truncate Command:


  • Truncate command is used to delete the all records in a table.The table skeleton won't changed.
           Syntax  : Truncate table <table name>
  • Roll back is not possible in Truncate command.
  • After execution of truncate command explicit commit is called
  • Condition Based filtering of records is not possible in Truncate command. 
  • It is DDL command,Explicit commit calls by itself.
  • It is very fast compared to the "Delete" command

Delete Command: 

  • Delete command is used to delete the particular record form a table. 
         Syntax : Delete from <table name> where condition
  • Roll back is possible in Delete Command.Because it stores the record in roll back memory.
  • It is DML command so it requires the explicit commit statement by the programmer.
  • It requires the condition to remove the data from a table.
  • It removes the one record at a time.
  • It is slow compared to "Truncate" Command.

     

2 comments:

Unknown said...

good but requires some more data

Unknown said...

really Awesome...............