TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Oracle Truncate Table

Oracle Truncate Table Query for beginners and professionals with examples on insert, select, update, delete, table, view, join, key, functions, procedures, indexes, cursor etc.

<< Back to 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.

Syntax

TRUNCATE TABLE [schema_name.]table_name 

Parameters

1) schema_name: This parameter specifies the name of the schema that the table belongs to. It is optional.

2) table_name: It specifies the table that you want to truncate.

Oracle TRUNCATE Table Example

Consider a table named "customers" and execute the following query to truncate this

TRUNCATE TABLE customers;

Output

Table truncated.
1.11 seconds

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.

Oracle DELETE Table Example

DELETE TABLE customers;

TRUNCATE TABLE vs DELETE TABLE

Both the statements will remove the data from the "customers" table but the main difference is that you can roll back the DELETE statement whereas you can't roll back the TRUNCATE TABLE statement.





Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf