On 27 December 2017 at 16:56, Booth Martin <booth@xxxxxxxxxxxx> wrote:
Rudimentary questions follow. I believe I read the material correctly. I
also believe I have misunderstood what I read. Hence the questions.
I myself don't know which 'the material' you've read. Some links, or
even a title might give me a hint as to what you've seen, and perhaps
why it's problematic.
This venture in to ROW CHANGE TOKEN territory is because of recommendations
made here. The whole concept is brand new ground for me. I am looking to
solve the "was it changed at another workstation?" problem.
I find this problem space to be so large that it defies a single,
generic 'solution'. When I encounter this sort of situation, I narrow
my focus down to a more specific, concrete situation. What is this
application updating, what's on the screen, what does the database
record look like? Post some code so we can recreate the situation on
this side of the glass. :-)
Is ROW CHANGE TOKEN a reliable solution or do I need to also use a timestamp
column and compare both fields?
Is ROW CHANGE TOKEN a valid solution for V5R4 releases & forward?
Introduced at 6.1
This statement gives me SQL 0104:
CHANGE_TS TIMESTAMP FOR EACH ROW ON UPDATE
AS ROW CHANGE TIMESTAMP NOT NULL);
This is a direct copy/paste from an IBM site.
Anyway, vocabulary will get us all in the end.
What's posted here is a 'clause'.
The 'statement' would be 'create table' or 'alter table'.
ROW CHANGE TIMESTAMP is not the same thing as ROW CHANGE TOKEN.
ROW CHANGE TIMESTAMP is an actual time stamp of the moment the row was
changed, and it's an actual column you put in your table.
CREATE TABLE
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/db2/rbafzhctabl.htm
(search for ROW CHANGE TIMESTAMP)
Database > Reference > SQL reference > Statements
ROW CHANGE TOKEN is an internal BIGINT for you so that you don't /have
to/ put a ROW CHANGE TIMESTAMP in your table. In my personal
experience, the ROW CHANGE TIMESTAMP is more useful to me because I
can ask the system to give me all the rows changed in a particular
time period. The only thing that TOKEN tells me is whether a row
experienced a change or not.
ROW CHANGE expression
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/db2/rbafzrowchg.htm
Database > Reference > SQL reference > Language elements > Expressions
Have you read IBM Systems Magazine's May 2009 article on Optimistic locking?
http://ibmsystemsmag.com/ibmi/administrator/db2/db2-offers-a-better-approach-to-optimistic-locking/
--buck
As an Amazon Associate we earn from qualifying purchases.