This topic describes how to delete all data from a specified partition or subpartition while preserving its structure.
Syntax
The ALTER TABLE…TRUNCATE PARTITION command deletes all data from a specified partition or subpartition and preserves the structure of the partition or subpartition.
ALTER TABLE table_name
TRUNCATE PARTITION partition_name [,partition_name] ...If you run this command on a table that has subpartitions, the operation also applies to all subpartitions of the specified partition.
In this syntax, partition_name can be:
{partition_name | subpartition_name}Parameters
Parameter | Description |
table_name | The name of the partitioned table. The name can be qualified with a pattern. |
partition_name | The name of the partition to delete. |
subpartition_name | The name of the subpartition to delete. |
Examples
Delete data from partition q1_2012 and subpartition p5 of the sales_range_list table:
ALTER TABLE sales_range_list TRUNCATE PARTITION q1_2012,p5;Delete data from subpartition p5 of the sales_range_list table:
ALTER TABLE sales_range_list TRUNCATE PARTITION p5;