当前位置: 首页 > 图文教程 > 数据库 > MYSQL > mysql创建Bitmap_Join_Indexes中的约束与索引

MYSQL
MYSQL教程:新手该看的MYSQL操作
php教程:mysql的常用语句
MySQL5数据导入到MySQL3中的具体操作
PHP+MYSQL网站开发中遇到的问题汇总
WordPress的MySQL连接出错监测方法
MSSQL和Mysql自定义函数与存储过程
PHP+MYSQL网站开发中关于时间的问题
MySQL的1067错误解决方案大全
临时表在SQL Server和MySql中创建的方法
PHP+MYSQL+Flash做留言本
MYSQL5.0家族提供的性能跟踪器
替换数据库某字段的内容:REPLACE函数
PHP删除MYSQL数据库中所有表的代码
怎样解决mysql连接过多的错误?
cannot create windows service for mysql.error:0
MySQL的1067错误解决
如何指定MySQL只监听某个特定地址?
把数据从MySQL迁到Oracle的几点注意事项
MySQL默认密码修改的方法
为MySQL的root用户指定一个目录

MYSQL 中的 mysql创建Bitmap_Join_Indexes中的约束与索引


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 113 ::
收藏到网摘: n/a

现象:创建Bitmap Join Indexes时出现ORA-25954报错: 维的主键或唯一约束条件缺失。 53vi.Com 原因:受到约束与索引的影响。 测试过程如下:
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则不会报错。