My Oracle Support Banner

Recommended Example of Using Wildcards with Escaped Terms in Oracle Text Queries (Doc ID 1307213.1)

Last updated on JANUARY 10, 2020

Applies to:

Oracle Text - Version 8.1.7.4 to 12.1.0.2 [Release 8.1.7 to 12.1]
Information in this document applies to any platform.
***Checked for relevance on 06-Feb-2013***

Symptoms

An Oracle Text query which includes escape characters for reserved words with wildcard characters return results which at first glance might look incorrect, but are the result of consistent behavior.

Consider the following example:

create table test(text varchar2(20));
insert into test values('ABC TR AZ DEF');
insert into test values('ABC TR DEF');
insert into test values('ABCTRDEF');
commit;
create index test_idx on test(text) indextype is ctxsys.context;


TR is a reserved word, so any query on a phrase that includes a whitespace delimited TR will fail unless that phrase or term is escaped out using the escape characters { }.

Using wildcards around a phrase may not return the intended match, e.g.:

select * from test where contains(text,'%{C TR D}%')>0;


nor will putting wildcards inside the braces:

select * from test where contains(text,'{%C TR D%}')>0;



Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.