Solved

Oracle Text Contains Problem

Posted on 2009-06-30
3
570 Views
Last Modified: 2013-12-19
Hi Everyone,
I'm using the Oracle Text contains function, but it sometimes doesn't work properly.  It returns 0 (text not found) when the text is actually there.

For example:

select e.* , contains(e.emp_name, '%Jones%') as cont_val
from emp_table e
where e.emp_name = 'Jones'

Returns a row with cont_val = 0 (which means text not found).  Results for %Jones% in the contains function in the where clause return no rows.  This is a sporadic problem that only occurs for some rows in our table.  We're using Oracle 10.2.0.1.0.
Any ideas what's going on?
Thanks

0
Comment
Question by:leclaude
  • 2
3 Comments
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24828838
How are you updating your text indexes? They are not immediately synched and must be maintained, unlike regular indexes.

http://download.oracle.com/docs/cd/B15595_01/content.101/b14493/text.htm#sthref776

See the docs on ctx_ddl.sync_index() for manually synching, try a manual sync and see if it shows.

0
 
LVL 1

Author Comment

by:leclaude
ID: 24903920
Why would an index need to be synched to return a row? At worst the query should be slow, but not miss results.
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 500 total points
ID: 24906622
That is how text indexes work. Text indexes are not standard Oracle b-tree indexes. The update does not happen immediately upon insert or update of the rows. Instead the change is scheduled, and will be applied when the next sync is run. In 10g and 11g I believe there is a setting that forces immediate update but it is poor for performance.

Please read this for an explanation:

http://www.oracle.com/technology/products/text/htdocs/Index_Maintenance.html
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question