Reputation: 3530
select id from dm_unit where aa like '%'||?||'%'
Upvotes: 0
Views: 112
Reputation: 2998
sorry i am not giving an answer I just want to understand why not to use : LIKE '%?%'
Upvotes: 0
Reputation: 14285
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)
Upvotes: 1
Reputation: 40499
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%'
.
Upvotes: 1
Reputation: 342635
The inner quotes need to be escaped?
select id from dm_unit where aa like '%\'||?||\'%'
Upvotes: 2
Reputation: 498924
You need to escape the internal single quotes, this can be done by doubling them:
select id from dm_unit where aa like '%''||?||''%'
Upvotes: 1