Oracle Text - DRG-10599:Column not Indexed

Following are the Steps i followed:

Step 1: Create Table

CREATE TABLE Test_Table01
(
Cust_ID NUMBER,
Cust_NAME VARCHAR2(200 BYTE),
CONSTRAINT PK_Cust_ID PRIMARY KEY (Cust_ID) USING INDEX TABLESPACE INDX
)
TABLESPACE USERS;

Step 2: Create CONTEXT Index on SDN_NAME.

CREATE INDEX INDX_Cust_NAME ON Test_Table01
(Cust_NAME)
INDEXTYPE IS CTXSYS.CONTEXT;

Step 3: Insert Data into Test_Table01

Insert into TEST_TABLE01
(CUST_ID, CUST_NAME)
Values
(1, 'MARTIN DIAZ JOHN EDWARD');

Insert into TEST_TABLE01
(CUST_ID, CUST_NAME)
Values
(2, 'NKOMO JOHN');

Insert into TEST_TABLE01
(CUST_ID, CUST_NAME)
Values
(3, 'PINZON CEDIEL JOHN JAIRO');

Insert into TEST_TABLE01
(CUST_ID, CUST_NAME)
Values
(4, 'MENDEZ SALAZAR JOHN JAIRO');

COMMIT;

Step 3:

select * from Test_Table01
where contains(CUST_NAME),'JOHN') > 0;

No Rows Returned.

Step 4:

select * from Test_Table01
where contains(UPPER(CUST_NAME),UPPER('JOHN')) > 0;

ORA-20000: Oracle Text error:
DRG-10599: column is not indexed

-------------------------------------------------

In Step 4, i am getting column not indexed which i have done in Step 2.

answer:
 
CONTEXT indexes need to be explicitly synced by you (and afaik, CTXCAT synchronize automatically, but don't take my word for granted->refer to Oracle Text guide).

A quote from Oracle Text App. Guide:

http://download.oracle.com/docs/cd/B19306_01/text.102/b14217/quicktour.htm#CCAPP0200

Quote:
When you create a CONTEXT index, you need to explicitly synchronize your index to keep it up to date with any inserts, updates, or deletes to the text table.

Oracle Text enables you to do so with the CTX_DDL.SYNC_INDEX procedure.

So after you execute:

EXEC CTX_DDL.SYNC_INDEX('INDX_Cust_NAME', '2M');

I believe your query:

select * from Test_Table01
where contains(CUST_NAME,'JOHN') > 0;

will return the rows containing the word JOHN (don't have db with OracleText installed to try this out).


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26920263/viewspace-736164/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26920263/viewspace-736164/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值