You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Hi...@ext.cec.eu.int on 2006/02/16 14:42:18 UTC

Using percentages with like and parameter


Hello,

I have the following select :

Select * from table where label like  #keyword#

Does anyone know how to add the % percentages before and after the keyword. 

I tried it before and after but ibatis does not accept it. 
So I'm doing it in my class that calls the query but would like to know if
there is another solution.

Thanks,

Hilde




Re: Using percentages with like and parameter

Posted by Jared Blitzstein <ma...@blitzstein.net>.
The way I've done it is actually set the %'s when you setup  
#keyword#. So myObject.setKeyword("%myliketerm%");

On Feb 16, 2006, at 8:42 AM, Hilde.DE-GRAEVE@ext.cec.eu.int wrote:

>
>
> Hello,
>
> I have the following select :
>
> Select * from table where label like  #keyword#
>
> Does anyone know how to add the % percentages before and after the  
> keyword.
>
> I tried it before and after but ibatis does not accept it.
> So I'm doing it in my class that calls the query but would like to  
> know if there is another solution.
>
> Thanks,
>
> Hilde
>
>
>