Escape caracters in CONTAINS()
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Escape caracters in CONTAINS()

  1. #1
    Join Date
    Nov 2002
    Posts
    1

    Escape caracters in CONTAINS()

    Hi,

    we're using Oracle 9i 9.1 and Apple's WebObjects together. One of our applications is using ConText indexes and we have small problems with this.

    ConText seems to think that dashes are wildcards, for example, if we do:

    SELECT * FROM TABLE WHERE CONTAINS (FIELD,'33-99%',0) > 0

    instead of fetching any text that have 33-99 in it, it fetch anything with 33 in it. In pure SQL, I can escape the dash by putting a slash in front:

    '33\-99%'

    but WebObjects is stripping the slash so I still have the problem. So, finally, my question is: do you know of any other escape caracter that I can use instead of a slash ?

  2. #2
    Join Date
    Feb 2001
    Posts
    180
    From the manual:
    To search for employees with the pattern 'A_B' in their name:
    SELECT ename
    FROM emp
    WHERE ename LIKE '%A\_B%' ESCAPE '\';

    So you should be able to use another escape like:
    SELECT ename
    FROM emp
    WHERE ename LIKE '%A#_B%' ESCAPE '#';
    Regards
    Ben de Boer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width