达梦数据库创建间隔分区表(范围分区的扩展)的使用及说明
程序员文章站
2022-06-02 23:46:23
...
创建间隔分区
----按年创建间隔分区
CREATE TABLE interval_y
(
employee_id NUMBER,
employee_name VARCHAR2(20),
birthday DATE
)
PARTITION BY RANGE(birthday)
INTERVAL (NUMTOYMINTERVAL(1,'year'))
(
PARTITION partition2014 VALUES LESS THAN('2015-01-
01'),
PARTITION partition2015 VALUES LESS THAN('2016-01-
01')
);
----按月创建间隔分区
CREATE TABLE interval_m
(
employee_id NUMBER,
employee_name VARCHAR2(20),
birthday DATE
)
PARTITION BY RANGE(birthday)
INTERVAL (NUMTOYMINTERVAL(1,'month'))
(
PARTITION partition201401 VALUES LESS THAN('2014-02-
01'),
PARTITION partition201402 VALUES LESS THAN('2014-03-
01')
);
达梦不支持NUMTODSINTERVAL按日生成间隔分区,报错如下
CREATE TABLE i1
(
employee_id NUMBER,
employee_name VARCHAR2(20),
birthday DATE
)
PARTITION BY RANGE(birthday)
INTERVAL (NUMTODSINTERVAL(1,'day'))
(
PARTITION partition20140101 VALUES LESS THAN('2014-01-
02')
);
间隔表达式与分区列类型不匹配
上一篇: 前端错误监控总结