Timestamp comparison in Change Capture stage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dsuser7
Participant
Posts: 41
Joined: Sat Nov 29, 2008 2:21 am

Timestamp comparison in Change Capture stage

Post by dsuser7 »

Hi All

I have a parallel job with before dataset as Oracle table and after dataset - a Dataset.

There are Timestamp fields to be compared and these fields are nullable. As long as there are no nulls in both datasets, the comparison happens correctly.

So I have converted the timestamp to varchar using TimestampToString and mapped a default text value 'xxxx' in case of actual null, similarly converted the field from Oracle query using Trim(NVL(TO_CHAR(TmstpField),'xxxx')).

The metadata matches in both before and after datasets which is varchar(100) null - yes;

The timestamps still do not match which causes the changecode to be 3, even when they are the same.

Thanks for your responses.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I've found it safer to always specify explicit conversion formats and to never use the defaults. Thus I'd use a specific timestamp conversion format (preferably YYYY-MM-DD HH:NN:SS.nnnnnn so that you can correctly sort the string version of the timestamp).

You also should perform your NVL() function before your conversion, but that shouldn't affect your outcome (I don't have Oracle here to check).

You can try a test job where the change code 3 records have just these two columns output to a sequential file (using quoted strings to capture hidden spaces) to see if they are truly identical.
dsuser7
Participant
Posts: 41
Joined: Sat Nov 29, 2008 2:21 am

Post by dsuser7 »

Thank you for your reply.
I missed converting the timestamp format to Datastage timestamp format while reading from oracle connector stage. Now that both the timestamps being compared are in same format, it is working.
Post Reply