Adds a new subpartition to a specified first-level partition of a composite partitioned table. This operation expands the partition structure and affects data distribution. Before running this statement, ensure a subpartitioning policy is defined for the parent partition, and that the new subpartition's boundary or values do not conflict with existing subpartitions.
Synopsis
ALTER TABLE table_name
MODIFY PARTITION partition_name
ADD SUBPARTITION { list_subpartition | range_subpartition };
-- LIST subpartition definition
SUBPARTITION subpartition_name
VALUES (value[, value]...)
[TABLESPACE tablespace_name]
-- RANGE subpartition definition
SUBPARTITION subpartition_name
VALUES LESS THAN (value[, value]...)
[TABLESPACE tablespace_name]
Parameters
Parameter | Required | Parameter description | Example |
| Yes | The name of the target composite partitioned table. |
|
| Yes | The name of the target first-level partition where the new subpartition will be added. |
|
| Yes | The name of the new subpartition. |
|
| Yes | Defines the boundary values for the new subpartition. |
|
| Optional | Specifies the tablespace for the new subpartition. If you omit this parameter, it uses the table's default tablespace. |
|
Notes
The type of the new subpartition (
LISTorRANGE) must match the type of existing subpartitions under the same parent partition.subpartition_namemust be unique among all partitions and subpartitions in the table.When you add a
RANGEsubpartition, the boundary value defined byVALUES LESS THAN (...)must be greater than the upper boundary of all existing subpartitions.RANGEsubpartitions can only be appended in ascending order. To insert a subpartition in the middle, you can use theALTER TABLE ... SPLIT SUBPARTITIONstatement to split an existing subpartition.When you add a
LISTsubpartition, the values in itsVALUES (...)list cannot overlap with the values of any existing subpartitions in the same parent partition.ADD SUBPARTITIONacquires a table-level exclusive lock (AccessExclusiveLock). This lock blocks allDMLoperations and mostDDLoperations on the table. Run this command during off-peak hours and allow a sufficient time window for it to complete.ADD SUBPARTITIONdoes not limit the number of subpartitions that you can add. However, system resources impose a practical limit. For optimal performance and manageability, keep the total number of partitions for a single table under1,000.Do not use
ADD SUBPARTITIONto add a subpartition to a a partition governed by aMAXVALUEorDEFAULTrule.If the table has an index, the database automatically creates a corresponding index partition on the new subpartition.
You must be the table owner or have administrator privileges to run this command.
A new subpartition initially has no statistics. To ensure the query optimizer generates accurate execution plans, gather statistics for the table immediately after this operation.
Examples
Add a LIST subpartition to a RANGE-LIST composite partitioned table
This example adds a new subpartition for the Africa region to the partition for the year 2023. The table is composite-partitioned by sales year (RANGE) and sales region (LIST).
Add a RANGE subpartition to a RANGE-RANGE composite partitioned table
This example adds a subpartition for the second quarter (Q2) to the 2023 partition of a table that is composite-partitioned by order year (RANGE) and order date (RANGE).
FAQ
Q1: Why do I get the error ORA-14321: subpartition ... already exists?
This error occurs because the VALUES definition for the new subpartition conflicts with an existing one under the same first-level partition. For a LIST subpartition, the value already exists; for a RANGE subpartition, the new boundary is not higher than the last one. Specify a non-overlapping boundary value for the new subpartition.
Q2: Why do I get the error ORA-02269: partition does not exist?
This error occurs because the partition_name specified in the MODIFY PARTITION clause does not exist. Query the USER_TAB_PARTITIONS view to verify the correct name of the first-level partition.
Q3: Why do I get the error ORA-14150: subpartitioning is not specified?
You tried to run ADD SUBPARTITION on a partitioned table that does not have a subpartitioning policy. This command applies only to composite partitioned tables.
Q4: Why do I get the error ORA-01031: insufficient privileges?
The user running the command does not have the ALTER privilege on the target table. Contact a database administrator to grant the required privilege.
Q5: Why do I receive the error ORA-14074: partition bound must collate higher than that of the last partition?
The ADD SUBPARTITION command can only append a RANGE subpartition to the end of the existing range. To insert a subpartition in the middle, use the SPLIT SUBPARTITION command instead.
Related statements
ALTER TABLE ADD PARTITION: Adds a new first-level partition to a partitioned table.
ALTER TABLE DROP SUBPARTITION: Deletes a specified subpartition.
ALTER TABLE SPLIT SUBPARTITION: Splits one subpartition into two subpartitions.