View previous topic :: View next topic
|
Author |
Message |
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Hi,
We are trying to run this query through Java Application (Hibernate Interface)
Code: |
<query>
select col1,col2
from AccountReference accountReference
where lower(accountReference.accountReferenceIdExternal) like lower(?)||'%' escape '\'
</query>
|
Here "?" refers to Host variable value, we want to append "%" also in the like clause.
This is not working in java. But when I try to run the same query through DB2 client, (Data studio), Its working.
Can you please help on this? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Have you tried using %% instead of % since the % has a special meaning to Java? |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
Could you try changing
to
Code: |
like (lower(?) + "%") |
|
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Hi,
I tried all the above... only this works fine
Code: |
<query>
select col1,col2
from AccountReference accountReference
where lower(accountReference.accountReferenceIdExternal) like lower(?)||'%' escape '\'
</query> |
But I get the Sql code -132
Is there any way to append % clause to the host variable to make the query work? |
|
Back to top |
|
|
|