• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

return type of executeUpdate

 
padmaratna kamble
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends......
please tell me.
Statement st=......
int i=st.executeUpdate("query");

what would we the return value of the i .
it is giving 0 value while i am using in my programm
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This int value shows how much rows are affected by your sql statement.
for example how much rows are deleted / updated / inserted.

it return 0 when your statement does not affect any row , for example in DDL execution it may return 0.
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If the update happens correctly then the value is 1, if not its 0.

So if the value is 0, there is something in the query that is missing or may be the condition is not satisfied in the query.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vjy chin:
If the update happens correctly then the value is 1, if not its 0.


Its always number of affected rows, if your query updates 10 rows it would be 10. So It is always number of affected rows

Shailesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic