Range Lookups V7.5.2

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
NigeGriff
Premium Member
Premium Member
Posts: 46
Joined: Mon Nov 24, 2003 5:46 am

Range Lookups V7.5.2

Post by NigeGriff »

I have a scenario were i need to lookup a date value on the input stream against a reference oracle table.

Each reference table row contains a start and end date value and i need to lookup the row where the input date value falls between the start and end date values on the reference table row.

what is the most efficient range lookup method to meet the above requirement?
Thanks
Nigel
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

Post by Ragunathan Gunasekaran »

Hi ,

You could use the write Range map stage and write a dataset that partitions your data based on a range. You could then use this Range partitioned dataset with the lookup stage to perform a range look up
Regards
Ragu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I'm not sure this is correct. Write Range Map stage creates a range map to support Range partitioning, not Range lookup.

Range (or "between") lookups are available in version 8. ABout the only way I know to do it in version 7 is to use a sparse lookup with user-defined SQL containing an appropriate BETWEEN clause.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
NigeGriff
Premium Member
Premium Member
Posts: 46
Joined: Mon Nov 24, 2003 5:46 am

Post by NigeGriff »

Hi Ray,
I am trying to implement what you have suggested but was wondering how to reference a column on the input link in the user defined SQL as 0ne of the predicates. i.e.

SELECT RATE_STERLING
from CURRENCY_RATES_DIM
where FINANCIAL_DATE >= CURRENCY_RATES_DIM.START_DATE
and FINANCIAL_DATE <= CURRENCY_RATES_DIM.END_DATE

In the example above, FINANCIAL_DATE is a column on the input link.
Thanks
Nigel
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need a parameter marker or reference to the ORCHESTRATE structure, not the column name. For example one of the following.

Code: Select all

SELECT RATE_STERLING 
from CURRENCY_RATES_DIM 
where ? >= CURRENCY_RATES_DIM.START_DATE 
and ? <= CURRENCY_RATES_DIM.END_DATE 

Code: Select all

SELECT RATE_STERLING 
from CURRENCY_RATES_DIM 
where ORCHESTRATE.FINANCIAL_DATE >= CURRENCY_RATES_DIM.START_DATE 
and ORCHESTRATE.FINANCIAL_DATE <= CURRENCY_RATES_DIM.END_DATE 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
NigeGriff
Premium Member
Premium Member
Posts: 46
Joined: Mon Nov 24, 2003 5:46 am

Post by NigeGriff »

Thanks ray the second option worked fine.
Thanks
Nigel
Post Reply