ORACLE | ||||||||
| ||||||||
| ||||||||
| ||||||||
| ||||||||
| ||||||||
| ||||||||
| ||||||||
|
Oracle - Truncate Table
In Oracle, TRUNCATE TABLE statement is used to remove all records from a table. It works same as DELETE statement but without specifying a WHERE clause. It is generally used when you don't have to worry about rolling back
Once a table is truncated, it can't be rolled back. The TRUNCATE TABLE statement does not affect any of the table's indexes, triggers or dependencies.
TRUNCATE TABLE [schema_name.]table_name
Customer_id | name | lastname | city |
---|---|---|---|
1 | Meherish | Chowdary | Gujarat |
2 | Ajaashi | Nehra | Maharashtra |
3 | Kaivalya | Bhoopalam | Karnataka |
Consider a table named "customers" and execute the following query to truncate this
TRUNCATE TABLE customers;
Output :
Table truncated.
Now check the customers table, you will find that there is no data available in that table. It is equally similar to DELETE TABLE statement in Oracle.