This topic describes how to delete all data from a specified subpartition and retain the complete schema of the subpartition.
Syntax
The ALTER TABLE…TRUNCATE PARTITION statement is used to delete all data from a specified subpartition and retain the complete schema of the subpartition.
ALTER TABLE table_name
TRUNCATE PARTITION partition_name [,partition_name] ...
Note If you execute this statement on a table that contains subpartitions and specify the partition name, the data stored in the subpartitions of the specified partition is deleted.
partition_name
is:{partition_name | subpartition_name}
Parameters
Parameter | Description |
table_name | The name (optionally schema-qualified) of the partitioned table. |
partition_name | The name of the partition. |
subpartition_name | The name of the subpartition. |
Examples
Delete the data from the
p5
partition and the q1_2012
subpartition in the sales_range_list
partitioned table:ALTER TABLE sales_range_list TRUNCATE PARTITION q1_2012,p5;
Delete the data from the
p5
subpartition in the sales_range_list
partitioned table:ALTER TABLE sales_range_list TRUNCATE PARTITION p5;