Ana
Ana

Reputation: 325

How to escape & in Oracle text - CONTAINS?

I'm trying to get results for AT&T in SQL developer. I tried a couple of escape methods. Nothing seems to work. Can someone correct if the queries are wrong?

SELECT  DISTINCT(id)
FROM    words
WHERE   CONTAINS(word, 'AT' || chr(38) || 'T',1) > 0

SET ESCAPE ON
SELECT  DISTINCT(id)
FROM    words
WHERE   CONTAINS(word, 'AT\&T',1) > 0

SELECT  DISTINCT(id)
FROM    words
WHERE   CONTAINS(word, 'AT&' || 'T',1) > 0

SELECT  DISTINCT(id)
FROM    words
WHERE   CONTAINS(word, '{AT&T}',1) > 0

Upvotes: 0

Views: 200

Answers (0)

Related Questions