SQL Error: -302, SQLState: 22001 while using String function with a dynamic parameter in db2/hibernate

41 views Asked by At

Trying to run a query, in java. Will provide the part where I am facing issue with

select j.* .......... where lower(jp.value) = lower (:mailTo)...

query.setString("mailTo", mailTo);

List<Job> listJob = query.list();

Basically here when the String size is greater it is throwing the below error: The value of a host variable in the EXECUTE or OPEN statement is out of range for its corresponding use.. SQLCODE=-302, SQLSTATE=22001, DRIVER=3.69.24

When I am removing the lower function from the binded paramter, it is working fine eg: select j.* .......... where lower(jp.value) = (:mailTo)...

Also the issue is specific to db2, when I am running the same in Oracle/Postgres it is working as expected.

Tried to manually run and it is working as well, but trying to figure out why the issue is happening in hibernate/jdbc.

0

There are 0 answers