Table of Contents Previous Next



Use the ALTER TABLE… RENAME PARTITION command to rename a table partition. The syntax takes two forms.
ALTER TABLE table_name
RENAME PARTITION partition_name
TO new_name;
ALTER TABLE table_name
RENAME SUBPARTITION subpartition_name
TO new_name;
The ALTER TABLERENAME PARTITION command renames a partition.
The same behavior as previously described applies for the subpartition_name used with the RENAME SUBPARTITION clause.
You must own the specified table to invoke ALTER TABLERENAME PARTITION or ALTER TABLE RENAME SUBPARTITION.
Query the ALL_TAB_PARTITIONS view to display the partition names:
The following command renames the americas partition to n_america:
ALTER TABLE sales
RENAME PARTITION americas TO n_america;
Querying the ALL_TAB_PARTITIONS view demonstrates that the partition has been successfully renamed:
Use the ALTER TABLE… SET INTERVAL command to convert an existing range-partitioned table to interval partitioning. The database automatically creates a new partition of a specified range or interval for the partitioned table when INTERVAL is set. The syntax is:
ALTER TABLE table_name SET INTERVAL (constant | expression);
ALTER TABLE table_name SET INTERVAL ();
Specifies a NUMERIC, DATE, or TIME value.
The ALTER TABLE… SET INTERVAL command can be used to convert the range-partitioned table to use interval partitioning. A new partition of a specified interval is created and data can be inserted into the new partition.
The SET INTERVAL () command can be used to disable interval partitioning. The database converts an interval partitioned table to range-partitioned and sets the boundaries of the interval partitions to the boundaries for the range partitions.
The example that follows sets an interval partition of the sales table from range partitioning to start using monthly interval partitioning. Use the following command to create the sales table:
To set the interval partitioning from the sales table, invoke the following command:
Query the ALL_TAB_PARTITIONS view before a database creates an interval partition.
Now, insert data into the sales table that exceeds the high value of a range partition.
Then, query the ALL_TAB_PARTITIONS view again after the insert. The interval partition is successfully created and data is inserted. A system-generated name of the interval partition is created that varies for each session.


Table of Contents Previous Next