0

it returns the current value of the select column, all i need is to return the original value for checking if the value really changed.

while(rs.next()){
    if (rs.rowUpdated){
        String strOrigVal = "";
        rs.getOriginalRow();
        strOrigVal = rs.getString("col1");
    }
}
ram
  • 29
  • 10

1 Answers1

2
ResultSet getOriginalRow()
                     throws SQLException
while(rs.next()){
  if (rs.rowUpdated){
      String strOrigVal = "";
      ResultSet ors = rs.getOriginalRow(); //you should catch the return value
      if(ors.next()){ //move to the first cursor
        strOrigVal = ors.getString("col1");
      }    
  }
}
Roger Dwan
  • 740
  • 4
  • 6
  • do i need to set the cursor position? whenever i called ors.getString("col1") there is an exception "SEVERE: null java.sql.SQLException: Invalid cursor position" – ram Nov 25 '15 at 03:53
  • Sorry, my bad. Yes, you need to set the cursor position just like other ResultSet(ors.next()) to point to the first element. – Roger Dwan Nov 25 '15 at 06:03
  • last question, in ors variable only the current row of rs will be stored? – ram Nov 25 '15 at 06:50
  • I do not try whether there more than one row, but according to the Java API document, It only return the current row. – Roger Dwan Nov 25 '15 at 06:56