Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] DB2 Advice Required -- Row Change Timestamp
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] DB2 Advice Required -- Row Change Timestamp
 Login/Join
 
Master
posted
I have a unique record extraction requirement where I need to pull records that have changed recently but that don't have an explicit timestamp in the table's fields. I've stumbled across a couple of threads on the Internet that say things on the line of

quote:

if you use DB2 v9 or later, you can use row change timestamp even if you didn't have the timestamp column

SELECT 1 FROM T1 WHERE ROW CHANGE TIMESTAMP FOR TAB t1 > current timestamp - 1 hours;


Is there anyone in WebFOCUS/Data Migrator land that has coded to this kind of concept that can help me with some of the basics? I'd be much obliged.

J.

This message has been edited. Last edited by: <Kathryn Henning>,



 
Posts: 959 | Location: At the Mast | Registered: May 17, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Dear John,
The idea seems very appealing to me, so although I have not used it, I tried to work with it and found out in our DB2 V9.5 it is not working as you suggest.
According to the IBM DB2 manual you indeed do need a timestamp column on the table defined with CREATE/ALTER table defined as GENERATED FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP.
It seems it will become an implicitly hidden column, therefor it seems the table does not have the timestamp, but apparantly it should have been defined in this way to be used in your SELECT statement.

As stated, I did not know about this DB2 feature, and it might be different in other version than our V9.5 (LUW), but this is what I found in the DB2 manual.


WebFocus 8203M, iWay DataMigrator, Windows, DB2 Windows V10.5, MS SQL Server, Azure SQL, Hyperstage, ReportCaster
 
Posts: 154 | Registered: March 29, 2013Reply With QuoteReport This Post
Virtuoso
posted Hide Post
It looks like DB2 is an MVCC family database, so it's possible that you could get the information you want from something akin to a transaction id for the records. In general, the higher the transaction id the more recent the row.

Whether that helps depends on what you consider "changed" though. Inserted and updated records will be visible to your current transaction (if committed, of course) and you might be able to obtain the id of the transaction they originated from. Deleted (committed) records however won't be visible to your transaction.

I'm not sure this applies to DB2, but it's worth a shot.

You might want to mention what version and flavour of DB2 we're talking about here Wink

Edit: Google says: http://www.ibm.com/developerwo...icle/dm-0505stolze2/


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1655 | Location: Enschede, Netherlands | Registered: August 12, 2010Reply With QuoteReport This Post
Guru
posted Hide Post
It appears that DB2 support of ROW CHANGE TIMESTAMP varies with platform (z/OS, Linux, Windows) and release (9.1, 9.2, etc.) so check that the expression works through the native DB2 client.

In the current Release 7.7.05 you can enclose DB2 dialect specific syntax in DB_EXPR(...) or you can create a synonym for an external SQL script and use that as a source.

In any DataMigrator release with a DBMS SQL Flow you can use any valid DB2 SQL expression that returns a result.
 
Posts: 391 | Location: New York City | Registered: May 03, 2007Reply With QuoteReport This Post
Master
posted Hide Post
quote:
DB_EXPR(


I'm on 7.7.04D and that function isn't available to me. It's a nice idea though, looking forward to it someday.

Thanks for the response. I have a similar post on the I-Way forums and maybe someone knows another way to skin the cat.

J.



 
Posts: 959 | Location: At the Mast | Registered: May 17, 2007Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] DB2 Advice Required -- Row Change Timestamp

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.