国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

創建Bitmap_Join_Indexes中的約束與索引

2024-07-21 02:42:27
字體:
來源:轉載
供稿:網友
現象:創建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則不會報錯。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 阿城市| 龙海市| 丽江市| 墨江| 海淀区| 屏东市| 雅安市| 沙田区| 澄迈县| 云林县| 张家界市| 且末县| 鄂温| 石楼县| 柞水县| 灵山县| 辉南县| 侯马市| 陕西省| 东至县| 馆陶县| 潢川县| 隆尧县| 临颍县| 福贡县| 金山区| 金乡县| 长乐市| 化州市| 梨树县| 汽车| 阜新| 德昌县| 高要市| 泉州市| 无极县| 武城县| 边坝县| 边坝县| 平昌县| 新龙县|