In the previous article, from the beginning we have created a new interval partitioning table, now in this article, we are going to change existing non partitioned table to interval partitioning table:
Create a non partitioned table:
create table table_interval_partitioning (id integer, hire_date date);
Insert some rows:
insert into table_interval_partitioning values (1, '02/01/2024');
insert into table_interval_partitioning values (2, '05/02/2024');
insert into table_interval_partitioning values (3, '15/09/2025');
Modify the table to interval partitionning table:
Specification of new partitions
First partition: table_interval_partitioning_part_01 : interval less than 01-04-2024
Second partiton: table_interval_partitioning_part_02 : interval less than 01-07-2024
alter table table_interval_partitioning modify
PARTITION by range (hire_date)
interval (NUMTOYMINTERVAL(3,'MONTH'))
(
partition table_interval_partitioning_part_01 VALUES LESS THAN (TO_DATE('01-04-2024', 'DD-MM-YYYY')),
partition table_interval_partitioning_part_02 VALUES LESS THAN (TO_DATE('01-07-2024', 'DD-MM-YYYY'))
);
Check the partitions:
Oracle server will create mission interval partition automatically
Enjoy !