Example: Adding a partition to a LIST partitioned table v14
This example adds a partition to the list-partitioned sales table. The table was created using the command:
CREATE TABLE sales
(
dept_no number,
part_no varchar2,
country varchar2(20),
date date,
amount number
)
PARTITION BY LIST(country)
(
PARTITION europe VALUES('FRANCE', 'ITALY'),
PARTITION asia VALUES('INDIA', 'PAKISTAN'),
PARTITION americas VALUES('US', 'CANADA')
);The table contains the three partitions americas, asia, and europe:
edb=# SELECT partition_name, high_value FROM ALL_TAB_PARTITIONS; partition_name | high_value ----------------+--------------------- EUROPE | 'FRANCE', 'ITALY' ASIA | 'INDIA', 'PAKISTAN' AMERICAS | 'US', 'CANADA' (3 rows)
This command adds a partition named east_asia to the sales table:
ALTER TABLE sales ADD PARTITION east_asia
VALUES ('CHINA', 'KOREA');After the command is invoked, the table includes the east_asia partition:
edb=# SELECT partition_name, high_value FROM ALL_TAB_PARTITIONS; partition_name | high_value ----------------+--------------------- EUROPE | 'FRANCE', 'ITALY' ASIA | 'INDIA', 'PAKISTAN' AMERICAS | 'US', 'CANADA' EAST_ASIA | 'CHINA', 'KOREA' (4 rows)