数据库信息:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production"
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
设置:
CREATE TABLE my_contains_test(
USERID VARCHAR2(8) NOT NULL,
SEARCH VARCHAR2(40),
CONSTRAINT contains_test_pk PRIMARY KEY (USERID)
);
INSERT ALL
INTO my_contains_test VALUES ('HUNTERW','Willie Hunter')
INTO my_contains_test VALUES ('HUWU','Will Hu')
SELECT * FROM dual;
create index ind_contains_test on my_contains_test(search) indextype is ctxsys.context;
查询:
select m.*, contains(search, 'will% and hu%', 1) as c_result from my_contains_test m;
结果:
USERID SEARCH C_RESULT
HUNTERW Willie Hunter 4
HUWU Will Hu 0
这是第二记录( C_RESULT == 0 )的好结果? 我不知道发生了什么。
这里有精彩的部分。 将名称更改为不同的名称,如 Willie
到 Billie
和 Will
到 Bill
,查询:
select m.*, contains(search, 'bill% and hu%', 1) as c_result from my_contains_test m;
结果是正确的:
USERID SEARCH C_RESULT
HUNTERW Billie Hunter 4
HUWU Bill Hu 4
所以在一个位置改变使它工作不同。 我不知道那是什么。 如何解决这个问题是很好的。