tags:

views:

70

answers:

1

Hi i am getting query output as all Records when i put & and % sign in my search string I am using oracle and mysql as a database

How i will avoid this , this is dynamically generated query snipit using java

WHERE 0 = 0 AND (LOWER (business_keywords) LIKE '%&%');

and

WHERE 0 = 0 AND (LOWER (business_keywords) LIKE '%%%');

thanks

+5  A: 

Escape them:

SELECT '%' LIKE '%\\%%'

You may need to provide your own escape character for this to be portable:

LIKE '%!%%' ESCAPE '!'

, since MySQL treats backslash as a special character while Oracle does not.

Quassnoi
Thanks its working
Yashwant Chavan