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.
精彩评论