Error while Querying : The value of a host variabl

2019-02-18 02:37发布

问题:

On trying to use a select query statement. The input variable has 8 characters just as expected.

I dont know why this error comes for select query because for a select query it will query and if its available it will return else it will retun blank rows.

Hibernate is used. Even in mapping its correctly mapped as 8 only.

This is what i found in log file:

Cause = com.ibm.db2.jcc.a.SqlException: The value of a host variable in the EXECUTE or OPEN statement is too large for its corresponding use.

Has anybody come across this error before? Please suggest me some solutions on why this error occurs..

回答1:

One possibility... This issue can come even in SELECT statement. When the parameter passed into the query is more than the size of its datatype's size, this error will pop-up.

Example:

Datatype - CHAR(12)
Search Param: "123456789012345"