TRUNCATE TABLE in Oracle

TRUNCATE TABLE
To truncate or remove records of a table but not the structure, the Oracle TRUNCATE TABLE statement is used. It is much similar to the DELETE statement but the TRUNCATE TABLE statement cannot be rolled back, which is possible in the case of the DELETE statement. Also, this statement does not affect indexes, triggers or dependencies of the table to be truncated.

Syntax:

TRUNCATE TABLE [schema_name].table_name


Parameters:
schema_name: It is used to specify the name of the schema that the table to be truncated belongs to.
table_name: It is used to specify the name of the table to be truncated.

Example:

TRUNCATE TABLE students;

Output:

Table truncated.
1.07 seconds


Explanation:
The ‘students’ is an already existing table. After the execution of the above command, there will be no data available in the table.