桌子上有多个分区?

时间:2012-02-07 17:03:53

标签: sql oracle

我的印象是可以在桌面上放置多个分区,所以当我输入以下代码时,我感到很惊讶:

CREATE TABLE ParentDetails1
(ParentID INTEGER NOT NULL,
ParentName VARCHAR (50) NOT NULL,
DateOfBirth DATE NOT NULL,
Gender VARCHAR (10) CHECK (Gender IN ('m', 'f')) NOT NULL,
CONSTRAINT ParentDetails_PK PRIMARY KEY (ParentID))
PARTITION BY RANGE (ParentName)
    (partition ParentNamePartition1 VALUES LESS THAN ('B'),
     partition ParentNamePartition2 VALUES LESS THAN ('D'),
     partition ParentNamePartition3 VALUES LESS THAN ('F'),
     partition ParentNamePartition4 VALUES LESS THAN ('H'),
     partition ParentNamePartition5 VALUES LESS THAN ('J'),
     partition ParentNamePartition6 VALUES LESS THAN ('L'),
     partition ParentNamePartition7 VALUES LESS THAN ('N'),
     partition ParentNamePartition8 VALUES LESS THAN ('P'),
     partition ParentNamePartition9 VALUES LESS THAN ('R'),
     partition ParentNamePartition10 VALUES LESS THAN ('T'),
     partition ParentNamePartition11 VALUES LESS THAN ('V'),
     partition ParentNamePartition12 VALUES LESS THAN ('X'),
     partition ParentNamePartition13 VALUES LESS THAN (MAXVALUE))
PARTITION BY HASH (ParentID)
    partitions 10
PARTITION BY LIST (Gender)
    (partition ParentGenderPartition1 VALUES ('m'),
     partition ParentGenderPartition2 VALUES ('f'))
CLUSTER
    ParentContact_Cluster (ParentID);

...并且得到错误声明只能在表上输入一个分区子句?!

有解决方法吗?

非常感谢, 祖鲁

2 个答案:

答案 0 :(得分:3)

您只能使用一个表的分区方案。该分区方案可能包括分区和子分区,具体取决于您尝试解决的问题。

在一个表上有多个竞争分区方案甚至意味着什么?

答案 1 :(得分:1)

您需要使用子分区来执行您想要执行的操作。 Oracle 11.2 docs