ALTER TABLE...SET SUBPARTITION TEMPLATE v16

Use the ALTER TABLE… SET SUBPARTITION TEMPLATE command to update the subpartition template for a table. The command syntax comes in several forms.

To set the subpartition number for HASH subpartitions only:

ALTER TABLE <table_name> SET SUBPARTITION TEMPLATE <num>;

To set a subpartition description for an existing partitioned table:

ALTER TABLE <table_name>
[SET SUBPARTITION TEMPLATE (<subpartition_template_description>)]

To reset the subpartitions number to default using the subpartition template:

ALTER TABLE <table_name> SET SUBPARTITION TEMPLATE ();

Parameters

table_name

The name (optionally schema-qualified) of the partitioned table.

num

The number of subpartitions to add for a partition.

subpartition_template_description

The list of subpartition details with subpartition name, subpartition bound, and tablespace name.

Description

You can use the ALTER TABLE… SET SUBPARTITION TEMPLATE command to update the subpartition template for range, list, or hash-partitioned table. If you're specifying a subpartition descriptor for a partition, use a subpartition descriptor instead of a subpartition template. You can use the subpartition template whenever a subpartition descriptor isn't specified for a partition. If you don't specify either the subpartition descriptor or subpartition template, then by default a single subpartition is created.

For more information about creating a subpartition template, see CREATE TABLE...PARTITION BY.

Note

The partitions added to a table after invoking ALTER TABLE… SET SUBPARTITION TEMPLATE command use the new SUBPARTITION TEMPLATE.

You can use the ALTER TABLE… SET SUBPARTITION TEMPLATE () command to reset the subpartitions number to default 1.

example_setting_a_subpartition_template