Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling function in database from servlet

 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am having multiple problems with my stored procedure func_ConvertDecimalHours. Could anyone have a look and tell me what I am doing wrong?

 
J. Kevin Robbins
Bartender
Pie
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couple of things. Tell us more about what's happening when you run this code and what you expect. Give us the stack trace if you have one. But even without that I see a couple of issues. First, for a stored procedure you want to use a CallableStatement, not a PreparedStatement. And I don't see where you are executing the statement. Is this an update or are you expecting a ResultSet to be returned? It's hard to tell from the function name. I would expect your code to look something like this:

This is just a rough guess. I have no idea what kind of result your stored procedure is returning, but this should help you to the next step.

And please avoid using variables with one character. It's not worth the effort of deciphering the code especially several months from now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic