PX Range Lookup

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
Nick_6789
Participant
Posts: 32
Joined: Thu Jan 05, 2006 2:07 am

PX Range Lookup

Post by Nick_6789 »

Hi there,

I know there are various threads about Range lookup done in PX jobs. However, I can't seem to get an sql right were I to use the lookup directly from Db2 stage.

E.g.

Primary flow
========

Name, transaction_date

DB2 reference table
=============

transaction_id, min_date, max_date

How do I sorta pass in my prim flow 'transaction_date' field to the db2 sql statement? Does it go?

Select transaction_id, min_date, max_date
from reference_table
where ochestrate.transaction_date between min_date and max_date

Somehow I am still getting some error and ironing out the prob...

I thought of another solution, using lookup stage...

Where looking up with both min and max dates, I can insert a constraint in the lookup stage where transaction_date >= min_date and transaction_date <= max_date.

Appreciate the help. =)
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Try doing a simple single-key lookup to your DB2 stage. Activate the automatically generated SQL, and then click on user-defined so that ityou can edit the existing SQL. From that you will see the format and syntax and can add your own between condition easily.
Nick_6789
Participant
Posts: 32
Joined: Thu Jan 05, 2006 2:07 am

Post by Nick_6789 »

ArndW wrote:Try doing a simple single-key lookup to your DB2 stage. Activate the automatically generated SQL, and then click on user-defined so that ityou can edit the existing SQL. From that you will see the format and syntax and can add your own between condition easily.
Thanks for the advice.

I stuck to the direct lookup to db2 and it works. Thanks.
Post Reply