How To Use Truncate Table Statement in Oracle
Description
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
- Truncate table table_name;
Example
- Truncate table supplier;
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
- Delete from table_name;
Example
- Delete from suppliers;
Summary