免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 879 | 回复: 0
打印 上一主题 下一主题

创建Bitmap_Join_Indexes中的约束与索引 [复制链接]

论坛徽章:
1
15-16赛季CBA联赛之北控
日期:2022-03-04 22:35:50
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-07 10:20 |只看该作者 |倒序浏览

    来源:赛迪网    作者:Alice
现象:创建Bitmap Join Indexes时出现ORA-25954报错: 维的主键或唯一约束条件缺失。
原因:受到约束与索引的影响。
测试过程如下:
create table sales
as select * from sh.sales;
create table customers
as
select * from sh.customers;
create unique index CUST_ID_un on customers(CUST_ID);
创建:
Bitmap Join Indexes
create bitmap index sales_cust_gender_bjix
on sales(customers.cust_gender)
from sales,customers
where sales.cust_id=customers.cust_id;
报错如下:
第 3 行出现错误:
ORA-25954: 维的主键或唯一约束条件缺失
案例分析:在此处尽管定义了对表customers的唯一性索引,但是该索引并没有对表customers并没有唯一性约束,即表示唯一性索引并不表示对表进行唯一性约束;但是如果加了唯一性的约束,就不会出现报错,示例如下:
SQL> ALTER TABLE customers
2 MODIFY (cust_id CONSTRAINT customers_un unique);
表已更改。
SQL> create bitmap index sales_cust_gender_bjix
2 on sales(customers.cust_gender)
3 from sales,customers
4 where sales.cust_id=customers.cust_id;
索引已创建。
结论:
只要加了唯一性的约束,创建BJI则不会报错。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/31/showart_519619.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP