Page tree
Skip to end of metadata
Go to start of metadata

创建根据时间范围自动新增分区的分区表

create table
pos_data (
   start_date        DATE,
   store_id          NUMBER,
   inventory_id      NUMBER(6),
   qty_sold          NUMBER(3)
)
PARTITION BY RANGE (start_date)
INTERVAL(NUMTOYMINTERVAL(1, 'MONTH'))
( 
   PARTITION pos_data_p2 VALUES LESS THAN (TO_DATE('1-7-2007', 'DD-MM-YYYY')),
   PARTITION pos_data_p3 VALUES LESS THAN (TO_DATE('1-8-2007', 'DD-MM-YYYY'))
); 

将原有时间范围分区表设置为自动新增分区

--调整为周期自动增加分区
alter table sys_exceptions set INTERVAL(NUMTOYMINTERVAL(1, 'MONTH')) ;


  • No labels