Solved

Oracle Text Contains Problem

Posted on 2009-06-30
3
574 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
pivot rows to columns 1 59
update statement in oracle 9 49
construct a query sql 11 37
Need to Implment Subset of Oracle Schema to Read-Only version 7 31
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ā€¦
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

738 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