0% found this document useful (0 votes)
24 views1 page

Truncate Table

The TRUNCATE TABLE statement is used to efficiently remove all rows from a table without the ability to roll back the action or retrieve the data afterward. It deallocates space used by the removed rows and is generally faster than using the DELETE statement, especially for tables with many dependencies. To execute this command, the user must have the appropriate privileges, and it can also be applied to private temporary tables without affecting existing transactions.

Uploaded by

Venkat Kv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Truncate Table

The TRUNCATE TABLE statement is used to efficiently remove all rows from a table without the ability to roll back the action or retrieve the data afterward. It deallocates space used by the removed rows and is generally faster than using the DELETE statement, especially for tables with many dependencies. To execute this command, the user must have the appropriate privileges, and it can also be applied to private temporary tables without affecting existing transactions.

Uploaded by

Venkat Kv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

TRUNCATE TABLE

Purpose
Note:
You cannot roll back a TRUNCATE TABLE statement, nor can you use a
FLASHBACK
TABLE statement to retrieve the contents of a table that has been truncated.
Use the TRUNCATE TABLE statement to remove all rows from a table. By default,
Oracle
Database also performs the following tasks:
• Deallocates all space used by the removed rows except that specified by the
MINEXTENTS
storage parameter
• Sets the NEXT storage parameter to the size of the last extent removed from
the segment
by the truncation process
Removing rows with the TRUNCATE TABLE statement can be more efficient than
dropping and recreating
a table. Dropping and re-creating a table invalidates dependent objects of the
table,
and requires you to repeat the following actions:
• Grant object privileges on the table
• Create the indexes, integrity constraints, and triggers on the table
• Specify the storage parameters of the table
Truncating has none of these effects.
Removing rows with the TRUNCATE TABLE statement can be faster than
removing all rows with
the DELETE statement, especially if the table has numerous triggers, indexes,
and other
dependencies.
See Also:
• DELETE and DROP TABLE for information on other ways of removing data from
a table
• TRUNCATE CLUSTER for information on truncating a cluster
Prerequisites
To truncate a table, the table must be in your schema or you must have the
DROP ANY TABLE
system privilege.
To specify the CASCADE clause, all affected child tables must be in your schema
or you must
have the DROP ANY TABLE system privilege.
You can truncate a private temporary table with the existing TRUNCATE TABLE
command.
Truncating a private temporary table will not commit and existing transaction.
This applies to
both transaction-specific and session-specific private temporary tables. Note that
a truncated
private temporary table will not go into the RECYCLEBIN.
Chapter 19
TRUNCATE TABLE
19

You might also like