表列必须与集群列具有相同的数据类型。在您的示例中,这可以正常工作:
create table test1 (
id int
) cluster abc_clus(id);
Table TEST1 created.
如果数据类型匹配,那么即使复合键也可以使用:
create table test2 (
a int,
b int,
primary key(a, b)
) cluster abc_clus(a);
Table TEST2 created.
但是,如果数据类型不同,则会收到错误消息:
create table test3 (
vc varchar2(7)
) cluster abc_clus(vc);
ORA-01753: column deFinition incompatible with clustered column deFinition
并且数据类型必须完全相同,甚至int
并且number
不兼容:
create table test4 (
n NUMBER
) cluster abc_clus(n);
ORA-01753: column deFinition incompatible with clustered column deFinition
编辑:
您甚至可以拥有复合集群:
创建集群idc_clus(i int,d date);
在集群idc_clus上创建索引idc_clus_idx;
创建表test5(i int,d date,主键(i,d))集群idc_clus(i,d);