简体   繁体   中英

How to update updateble ResultSet with SQL Function e.g. NOW()

Is there any way to call SQL Function during updateXXX method in ResultSet of type ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE.

For example look at this code fragment:

stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery(query);
while (rs.next()) {
  rs.updateTimestamp("status_time", "NOW()"); // call some SQL function during update
  rs.updateRow();
}

Is there any way to update value such way? The above example ofcourse don't work.

You can't do that. These methods are for setting actual values, not for executing SQL functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM