This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Spring JDBC: registering the SQL type with MapSqlParameterSource