列定义与聚集列定义不兼容 [英] Column definition incompatible with clustered column definition

查看:62
本文介绍了列定义与聚集列定义不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Oracle 中创建了一个集群

I have created a cluster in Oracle

CREATE  CLUSTER myLovelyCluster (clust_id NUMBER(38,0))
SIZE 1024 SINGLE TABLE HASHKEYS 11;

比表为集群

 CREATE TABLE Table_cluster
CLUSTER myLovelyCluster (columnRandom)
AS SELECT * FROM myTable ;

columnRandom 被很好地定义为 NUMBER(38,0) 但为什么我在假设列定义不兼容时出现错误?

the columnRandom is well defined as NUMBER(38,0) but why I am getting an error assuming incompatible column definition?

谢谢

推荐答案

你确定 columnRandom 是 number(38,0) 吗?在预言机中 NUMBER != NUM​​BER(38,0)

Are you sure that columnRandom is number(38,0)? In oracle NUMBER != NUMBER(38,0)

让我们创建两个表.

create table src_table ( a number);
create table src_table2( a number(38,0));

select column_name,data_precision,Data_scale from user_tab_cols where table_name like 'SRC_TABLE%';

查询结果是.列的定义不同.

Result of query is. Definitions of column are different.

+-------------+----------------+------------+
| Column_name | Data_Precision | Data_scale |
+-------------+----------------+------------+
| A           |                |            |
| A           |             38 |          0 |
+-------------+----------------+------------+

如果我尝试为第一个表创建集群.

And if i try creat cluster for first table.

CREATE TABLE Table_cluster
CLUSTER myLovelyCluster (a)
AS SELECT * FROM src_table ;

ORA-01753:列定义与聚集列定义不兼容

2-nd 一切正常.

CREATE TABLE Table_cluster
CLUSTER myLovelyCluster (a)
AS SELECT * FROM src_table2 ;

如果您将演员表添加到选择中.执行也是正确的.

If you add cast into select. Execution also is correct.

CREATE TABLE Table_cluster CLUSTER myLovelyCluster  (a)
AS SELECT cast(a as number(38,0)) FROM src_table;

这篇关于列定义与聚集列定义不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆