ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Bruns <brian.br...@gmail.com>
Subject Re: Using a like statement
Date Tue, 31 May 2005 16:15:49 GMT
FAQ misses my favorite approach which is:

select * from table1 where column like #parm# || '%'

It gives all the advantages of using #parm# over $parm$ and you don't
need special processing in the java code to add the '%' .  The
downside is that || is not universal for string concatenation, so
porting maps from one db to another might be a little harder.

Brian

2005/5/31, Larry Meadors <larry.meadors@gmail.com>:
> It is in the FAQ: http://opensource.atlassian.com/confluence/oss/display/IBATIS
> 
> Larry
> 
> 
> On 5/31/05, Steven Pannell <steven.pannell@zooplus.com> wrote:
> > Hi,
> >
> > Is there an easy way to describe a 'like' statement in the iBatis xml file.
> > for example I have:
> >
> > <select id='dd' parameter="string">
> >         select * from bush where bush_name like #value#
> > </select>
> >
> > Using Oracle I have to make the value look like this:
> >
> >         String value = "hello%"
> >
> > Can't I do this in the map something like:
> >
> >
> > <select id='dd' parameter="string">
> >         select * from bush where bush_name like #value#%
> > </select>
> >
> >
> > At present this won't work.
> >
> > cheers,
> > Steve.
> >
>

Mime
View raw message