TRUNCATE TABLE
Removes all storage associated with a table, while leaving the table definition intact. TRUNCATE TABLE
auto-commits the current transaction after statement execution and cannot be rolled back.
TRUNCATE TABLE
removes all table history preceding the current epoch, regardless of where that data resides (WOS or ROS) or how it is segmented. Immediately after TRUNCATE TABLE
returns, AT EPOCH
queries on the truncated table return nothing.
Syntax
TRUNCATE TABLE [[db‑name.]schema.]table‑name
Parameters
[db‑name.]schema
|
Specifies a schema. If multiple schemas are defined in the database, include the schema name. For example: myschema.thisDbObject |
table‑name |
The name of the anchor table or temporary table to truncate. You cannot truncate an external table. |
Privileges
One of the following privileges is required:
- Superuser
- Table owner
- User with USAGE privileges on the table's schema—see GRANT (Schema)
- User granted truncate privileges—see GRANT (Truncate)
A schema owner can drop a table but cannot truncate a table.
Examples
See Truncating Tables in the Administrator's Guide.