«Back to Home

Oracle Jump Start

Topics

How To Use Truncate Table Statement in Oracle

Description
 
Truncate table statement is used to remove all the data records from a table in Oracle. Truncate statement woks like a Delete statement function.
Both these statements works same without a where clause.

Truncate statement is Data Definition language (DDL) command whereas Delete is a Data Manipulation Language(DML) command.
 
In this statement, you cannot Rollback in Truncate statement but you can Rollback in Delete statement.
 
Truncate statement removes the record permanently. Truncate command cannot use “where” clause condition.
 
If you have large quantity of data, you use Truncate statement to clear all the data records in the table.
Syntax
  1. Truncate table table_name;  
Example
  1. Truncate table supplier;  
1

Delete statement
 
Delete statement works same as a Truncate statement. Delete statement belongs to a Data Manipulation Language(DML).
 
In Delete command, statement can be Rollback.
 
Syntax
  1. Delete from table_name;  
Example
  1. Delete from suppliers;  
2

Summary
 
Thus, we learnt, Truncate table statement is used to remove all the data records from a table in Oracle. Truncate statement works like a Delete statement function. We learnt, how to use this command in Oracle with the examples.