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

int return on executeUpdate

 
Adam Sykes
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a stored procedure on an oracle database to insert one row. I am expecting a result of 1 to return but am getting 0. I thought if there was an error I would get either -1 or if a serious error then an SQLException? Can anyone offer an explanation!
 
Abdul Samed
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Adam,
The method executeUpdate returns
0 if no rows are updated
1 if one row is inserted
n if n rows are updated
So if it returns 0 then it means that there is some error in your insert statement
Regards
Abdul
 
Adam Sykes
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, but if I have an error in the insert shouldn't I also be expecting to catch an SQLException in a try/catch block around the executeUpdate?
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on what exactly the stored procedure is doing.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic