SELECT COUNT (*) TOTAL_RECORDS FROM VEHICLE_DETAIL WHERE ID = :id AND PRICE_CD = :code AND REC_DT = ate
If i put the hard-coded values in the sql then it works fine. But with the method above it returns "0". When i changed the column type for "code" to varchar in the database then it returns the count greater than "0". [ October 06, 2008: Message edited by: Hiren Shah ]
Joined: Oct 04, 2008
I got this reply on Spring forum.....
"You are using a CHAR(4) column so the data in that field is 4 characters long which would be '88 ' (notice the two spaces at the end). Supplying a string of length 2 will never match.
The reason the hardcoded SQL works is because the database engine is converting the literals provided to match the column type and is padding the values provided. When you are using bind variables there is no such conversion - you have to provide the correct data values."
Thank you, Hiren
subject: Spring JDBC: registering the SQL type with MapSqlParameterSource