创建Bitmap_Join_Indexes中的约束与索引_MySQL数据库_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

创建Bitmap_Join_Indexes中的约束与索引

作者:黑客防线网安MYSQL维护基地 来源:黑客防线网安MYSQL维护基地 浏览次数:0

本篇关键词:索引约束创建唯一
黑客防线网安网讯:  现象:创建Bitmap Join Indexes时出现ORA-25954报错: 维的主键或唯一约束条件缺失。   原因:受到约束与索引的影响。   测试过程如下:   create table sales   as select * fr...

  现象:创建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则不会报错。

    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-8461-1.html
网站维护教程更新时间:2012-03-20 04:56:13  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer