|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Select Query 'LIKE' IssueHello ,
I am using Ibatis 2.3.Issue Persist as Below mentioned. Query in Respective Configuration XML As: <select id="getSerialNumber" resultClass="java.lang.String"> select ifnull(max(account_number),0) from account_details where account_number like '$pattern$%' </select> TRIED PATTERS : $pattern$% , %$pattern$% So Here SQL always retuning Non Zero Value.If suppose In DB '99970' such data exist ,where i am trying to search for '99980' then also i am getting Non Zero Values.Ideally in this case DB Should return zero according to query. If any one of you understand the scenario please notify me any thing wrong in this. CONFIGURATION :: OK. Thanks in Advance, Suman |
|
|
Re: Select Query 'LIKE' IssueIf || is the operator for string concatenation, try
like '$pattern$' || '%' respectively like '%' || '$pattern$' || '%' gonas schrieb: > Hello , > > I am using Ibatis 2.3.Issue Persist as Below mentioned. > > Query in Respective Configuration XML As: > > <select id="getSerialNumber" resultClass="java.lang.String"> > select ifnull(max(account_number),0) from account_details where > account_number like '$pattern$%' > </select> > > TRIED PATTERS : $pattern$% , %$pattern$% > So Here SQL always retuning Non Zero Value.If suppose In DB '99970' such > data exist ,where i am trying to search for '99980' then also i am getting > Non Zero Values.Ideally in this case DB Should return zero according to > query. > > If any one of you understand the scenario please notify me any thing wrong > in this. > CONFIGURATION :: OK. > > Thanks in Advance, > Suman --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@... For additional commands, e-mail: user-java-help@... |
|
|
Re: Select Query 'LIKE' IssueI personally prefer to add the wildcards in the Java code. But concatenation in the SQL works as well.
Clinton
On Thu, Oct 15, 2009 at 6:31 AM, Ingmar Lötzsch <iloetzsch@...> wrote: If || is the operator for string concatenation, try |
| Free embeddable forum powered by Nabble | Forum Help |