为什么Oracle数据库按区间创建分区时要求至少提供单个分区

Why Oracle database requires to provide at least single partition when creating partition by interval

我想知道为什么 Oracle 数据库要求在创建时至少定义一个分区 PARTITION BY RANGE INTERVAL

这是正确的:

CREATE TABLE FOO ( bar VARCHAR2(10), creation_date timestamp(6) not null ) PARTITION BY RANGE (creation_date) INTERVAL (NUMTODSINTERVAL(1,'DAY')) ( PARTITION part_01 values LESS THAN (TO_DATE('01-03-2018','DD-MM-YYYY')) )

但这不是:

CREATE TABLE FOO ( bar VARCHAR2(10), creation_date timestamp(6) not null ) PARTITION BY RANGE (creation_date) INTERVAL (NUMTODSINTERVAL(1,'DAY'))

我希望在某些迁移情况下需要第一个分区,但在创建新的 table 时不需要。

关于此的 Oracle 文档:

The INTERVAL clause of the CREATE TABLE statement establishes interval partitioning for the table. You must specify at least one range partition using the PARTITION clause. https://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin001.htm#BAJHFFBE

没有默认间隔 Oracle 不知道从哪里开始间隔。对于每日分区,它不是那么明显,但假设您每周有一个分区,即 7 天。

应该是Monday-Monday还是Sunday-Sunday还是别的什么?

间隔“1 天”是什么意思?从 00:00:00 - 23:59:59 (如你的例子中隐含给出的)或其他东西,例如 12:00:00 - 11:59:59 (这将是 PARTITION part_01 values LESS THAN (TO_DATE('01-03-2018 12:00','DD-MM-YYYY HH24:MI'))