开发者

How to avoid & and % in search

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 '开发者_Python百科%%%');


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜