开发者

How can like 'z%' in eclipse query when 'z' is my parameter

开发者 https://www.devze.com 2023-02-20 09:02 出处:网络
For example select custName from Customer where custName like \'%john%\'; My parameter is custName, so in query Eclipse Birt report, I used

For example

select custName 
from Customer
where custName like '%john%';

My parameter is custName, so in query Eclipse Birt report, I used

select custName 
from Customer
where custName like '%?%';

But it wont work, how can I make this possible. I need help. C开发者_StackOverflowan anyone solve this matter?


You need to include the wildcard characters (%) in the parameter value.

For example

-- Parameter Value = "%john%"

SELECT custName from Customer WHERE custName LIKE ?


In Standard SQL, for which the concatenation symbol is || it would be:

WHERE custName LIKE '%' || :param_name || '%';

Guessing a translation to Eclipse:

WHERE custName LIKE CONCAT('%', param_name, '%');


For what it's worth, nearly 4 years later, this seems to work:

WHERE custName LIKE '%' || ? || '%'
0

精彩评论

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

关注公众号