i would like to do the following: there is a table in my database with several columns. i want to increase the value in one of them. Which one is not known, it depends on the value of one parameter of the function . i declare using preparedStatement.setString() which column is to be changed. My problem is that i dont know how to write the query so as to achieve this increament. something like update user_statistiks set ? = ?+1 where USER_ID = ? doesnt work.. the second questionmark is the problem.. does anyone know how i could write my query?
thanks in advance!
Joined: Mar 16, 2004
You can do it a couple of ways: The first requires executing two SQL statements. One to retrieve the row you wish to update, and then one SQL to perform the update. That's the first way.
Second way is to create an "updatable resultset" by doing the following: