How to do look for the greater than or less than date ranges

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
johncool
Participant
Posts: 1
Joined: Wed Oct 18, 2006 9:54 pm
Location: USA

How to do look for the greater than or less than date ranges

Post by johncool »

Table_A

PROD1, MFGSTARTDATE, MFGENDDATE

Table_B

PROD1, QADATE

I have to pass the records only when the 'QADATE' is
between 'MFGSTARTDATE' and 'MFGENDDATE'
Can anyone tell me which stage to use to achive this.
Thanks in advance.
Cool
gautham
Participant
Posts: 7
Joined: Fri Dec 16, 2005 12:28 pm

Re: How to do look for the greater than or less than date ra

Post by gautham »

we can achive this by writing a constraint in the target
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi,
If tables are from the same same schema you can do it SQL statement with where clause in it.
Else if tables have different schemas then you have use join stage to join the table based on the key and use filter stage for where clause.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Version 8.0 supports range lookup. Earlier versions do not, unless you resort to user-defined SQL.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

If you do search for range lookups, you will find many posts on this as it is discussed several times. You will get the solution in search itself :)
Regards,
S. Kirtikumar.
bmadhav
Charter Member
Charter Member
Posts: 50
Joined: Wed May 12, 2004 1:16 pm

Post by bmadhav »

U cannot do this in the current version of PX. U may want to call a server container in the PX job and do the range lookup in the server container by using a transformer stage and the appropriate database stage and then return the result back to the PX job.
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

Instead of the server shared container, check if the sparse lookup can be used. Sparse lookup allows you to fire queries at runtime. So you have to define Table_A as reference link with key columns mapped to QADATE.
Then in SQL in TABLEA, add the query which will have range condition.

But keep in mind - sparse lookups hit the performance. In case of sparse lookup, query is prepared with the value coming from stream link and then fires it on database.
Regards,
S. Kirtikumar.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Even (especially) sparse lookups only do equi-joins.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply