Topic
  • 2 replies
  • Latest Post - ‏2014-04-04T13:28:03Z by Damery
Damery
Damery
51 Posts

Pinned topic ROLLBACK ROW CHANGE TOKEN is changing?

‏2014-02-28T20:24:55Z |

Hello I hope someone can explain something to me.

We are trying to use ROW CHANGE TOKEN for data integrity checking, however we have discovered that if a record has a row change token of 1 and we try to update to 2 but have to roll back then the data reverts back to the previous values but the ROW CHANGE TOKEN stays at 2 instead of going back to the original value of 1....

Is this the way that this functions? Have we missed something in set up? Do I not understand ROW CHANGE TOKEN?

 

Any and all help appreciated.

  • NickLawrence
    NickLawrence
    64 Posts

    Re: ROLLBACK ROW CHANGE TOKEN is changing?

    ‏2014-03-03T20:56:24Z  

    See http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fsqlp%2Frbafyrcexpr.htm (Row Change Expressions) and http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fsqlp%2Frbafysqlprcts.htm (How to create a ROW CHANGE TIMESTAMP column).
     
    If a table does not contain a row change timestamp column, you can still use a row change token expression, but the result is less precise because DB2 does not keep track of a token ID for each individual row. (This approach should still work for optimistic locking, but may be more pessimistic than you want. The scenario you describe will indicate that the row might have changed - when it has not)
    If the table has a row change timestamp column, then you should get the results you expect....because DB2 has access to the updated timestamp for each specific row.

     

    Updated on 2014-03-03T20:57:55Z at 2014-03-03T20:57:55Z by NickLawrence
  • Damery
    Damery
    51 Posts

    Re: ROLLBACK ROW CHANGE TOKEN is changing?

    ‏2014-04-04T13:28:03Z  

    See http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fsqlp%2Frbafyrcexpr.htm (Row Change Expressions) and http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fsqlp%2Frbafysqlprcts.htm (How to create a ROW CHANGE TIMESTAMP column).
     
    If a table does not contain a row change timestamp column, you can still use a row change token expression, but the result is less precise because DB2 does not keep track of a token ID for each individual row. (This approach should still work for optimistic locking, but may be more pessimistic than you want. The scenario you describe will indicate that the row might have changed - when it has not)
    If the table has a row change timestamp column, then you should get the results you expect....because DB2 has access to the updated timestamp for each specific row.

     

    Looks like we will be using Row Id, Row Change Token with Row Change Timestamp for concurrency validation.