Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with context index 1

Status
Not open for further replies.

jaxtell

Programmer
Sep 11, 2007
349
US
I'm having an issue querying a table using a context index, when there is an ampersand in the contains section of the where clause. For example
Code:
SELECT inventory_item_id, keyword
FROM item_keywords
WHERE contains (keyword, 'AT' || chr(38) || 'T') > 0;
returns a lot more than I'd expect. But if I do this
Code:
SELECT inventory_item_id, keyword
                              FROM item_keywords
                             WHERE contains (keyword, 'AT' || chr(38) || 'T') > 0
                              and keyword like '%AT' ||chr(38)|| 'T%';
I get the results I expect. Do you know why? Is there a better solution than adding the second line to there where clause? It works the second way, so I can use it. I would prefer to fix the problem instead of work around it. The original query works fine if the string being compared doesn't contain an ampersand. For example
Code:
 SELECT inventory_item_id, keyword
                              FROM item_keywords
                             WHERE contains (keyword, '3COM') > 0;
returns the same results as
Code:
 SELECT inventory_item_id, keyword
                              FROM item_keywords
                             WHERE contains (keyword, '3COM') > 0
                             and keyword like '%3COM%';
Any suggestions would be appreciated. Thanks.

-----------------------------------------
I cannot be bought. Find leasing information at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top