What is the difference between TRUNCATE and DELETE in Oracle database?

1 Answers
Answered by suresh

The Difference Between TRUNCATE and DELETE in Oracle Database

When working with an Oracle database, it is important to understand the distinction between TRUNCATE and DELETE operations.

TRUNCATE

TRUNCATE is a DDL (Data Definition Language) operation that removes all rows from a table quickly and efficiently. It resets the high water mark of the table and releases the storage space back to the tablespace. TRUNCATE is a non-logged operation, meaning it cannot be rolled back and does not fire any triggers associated with the table.

DELETE

DELETE, on the other hand, is a DML (Data Manipulation Language) operation that removes rows from a table based on a condition. DELETE deletes the specified rows one by one, firing any associated triggers and logging each row deletion. Unlike TRUNCATE, DELETE can be rolled back using a ROLLBACK statement.

Focus Keyword: Oracle Database

In summary, the main difference between TRUNCATE and DELETE in Oracle Database lies in their mechanisms of operation and their impact on data integrity and system performance. Choosing between the two operations depends on the specific use case and requirements of the task at hand.

Answer for Question: What is the difference between TRUNCATE and DELETE in Oracle database?