This week's book giveaway is in the Design forum.
We're giving away four copies of Mastering Non-Functional Requirements and have Sameer Paradkar on-line!
See this thread for details.
Win a copy of Mastering Non-Functional Requirements this week in the Design forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

preparedStatement and setxxx(1, myxxx);  RSS feed

 
Heath Lilley
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble setting a bind variable to a (oracle 8) 2 digit number.

(The real query is rather large but it does work with '07' hard coded in place of the ?.)
Now according to the db myMonth is a NUMBER(2) type.
I tried the following:

but I get an Invalid number exception from the oracle drivers.
What do i need to call to bind a 2 digit number in a prepaired statement other than raw string concat'n?

[This message has been edited by Heath Lilley (edited January 16, 2001).]
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try setInt().
If that doesn't work, then you can try this technique.
psuedo-code
1. Get a database connection.
2. Get the metadata object.
3. Execute a getColumns() on that table.
4. Find the correct column name and get its column type from the result set.
5. Using the column type as the type for your setXXX() statement.
-Peter
[This message has been edited by Peter Tran (edited January 16, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!