• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

UPDATE

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am looking through the resultset and when I get a row of interest, then I want to update a few columns in the same row.
I am wondering whether I have to specify a 'where' clause in the update syntax, since I am looping through and the the row to be updated in the current row....
while( resultset.next() )
{
String status = resultset.getString("STATUS") ;
if( status == 12 )
{
String update = "update tablename set col1='1', col2='sd'";
stmt.executeUpdate(update);
}
}
Will the above 'update' statemet recognize that it has to update the current row?
Thanks!!
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think so!
How should it? The update statement is executed on the database and the database has no idea in which row of the resultSet you are. I think, the whole table will get the specified values in the columns!
 
Bala Krishniah
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Lars Vegas...
Then in hat case I'll specify the current row's Unique id no.
Thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic