开发者

How to avoid & and % in search

开发者 https://www.devze.com 2022-12-18 18:48 出处:网络
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

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

精彩评论

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