• Post Reply Bookmark Topic Watch Topic
  • New Topic

CallableStatement throwing data conversion error (Oracle)  RSS feed

Yan Lee
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All:

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.

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?

Thanks in advance.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!