CallableStatement throwing data conversion error (Oracle)
posted 12 years ago
I am using Oracle JDBC thin driver in my J2EE application. There is a CallableStatement that calls a stored proc on the data base.
One of the parameters passed to CallableStatement is a java.sql.Date. For that I am using stmt.setDate(1,updateDate). The code compiles fine but throws a number to character conversion error at runtime.
On further investigation, I found out that the CallableStatement class has only 2 setDate() methods and they use the parameter name as the first parameter-- void setDate(String parameterName, Date x) .
CallableStatement is a subclass of PreparedStatement that has a setDate(int parameterIndex, Date x). So obviously, method called must be on the PreparedStatement class.
MY QUESTION: How to use the setDate(String parameterName, Date x) method? Specifically, what should I put for parameter name? Is it the parameter as named in the stored proc? Has anyone encountered this issue? How was it solved?