开发者

what's wrong in this sql?

select id from dm_unit where aa like '%'|开发者_如何学JAVA|?||'%'  


The inner quotes need to be escaped?

select id from dm_unit where aa like '%\'||?||\'%'


You need to escape the internal single quotes, this can be done by doubling them:

select id from dm_unit where aa like '%''||?||''%'  


I assume you use the ? as a placeholder. If this is the case, the query should read select id from dm_unit where aa like ? and the placeholder's value should later on be bound to something like '%foobar%'.


I think you wrote \' in your query to use single quote in your query. but its not a right way. to use single quote in our query use '' (2 single quote) instead of ' (1 single quote)


sorry i am not giving an answer I just want to understand why not to use : LIKE '%?%'

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜