Oracle: TRUNCATE Command

What is TRUNCATE Command in Oracle?

  1. TRUNCATE command in SQL is used to delete Values from the specific table.
  2. TRUNCATE Command once applied on the table, locks that table. Thus, deleting all the rows of the table at a single go. 
  3. TRUNCATE is a DDL command that once applied cannot roll back the values. 
  4. No, WHERE clause is used with this command.
  5. The command does not affect the structure of database

Syntax

TRUNCATE TABLE Table_name;

Example

For instance, we have a table Temp as shown below:

Truncate Table

And we want to delete all the values in a table. For that, we can use TRUNCATE Command. We can perform the following command by the code below:

TRUNCATE TABLE Temp;

Output

Truncate Table

After applying the Select statement we will find the table as:

Truncate Table