LookUp Stage Condition Specification Issue

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
hemaarvind1
Participant
Posts: 50
Joined: Mon Jan 21, 2008 9:35 am

LookUp Stage Condition Specification Issue

Post by hemaarvind1 »

Hi All,

I have the following requirement:

I have a source A with a lookup B. Both the sources are Oracle databases.

I need to perform a lookup on these two sources based on key values.

The issue I have here is

The data coming from both the sources is similar,but differing in various aspects like case sensitivity,length of the strings.

For Example, Source A has data like "MOSCOW" and Source B has data like "Moscow ". Our requirement is to load this kind of data as a single string "MOSCOW".

I tried using lookup stage condition,however, I was not sure how to specify the condition for the above.

Could you please help me in this regard.

Thank You.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Maybe you are looking for UpCase() !?
hemaarvind1
Participant
Posts: 50
Joined: Mon Jan 21, 2008 9:35 am

Post by hemaarvind1 »

It is not Upcase. May be my query was a little vague to get you to that conclusion. Whatever data is coming in Source A , if it is present in Source B, I need data from Source A. There is no specific upcase requirement.
ETLJOB
Participant
Posts: 87
Joined: Thu May 01, 2008 1:15 pm
Location: INDIA

Post by ETLJOB »

Convert data from the sources to Uppercase and do the lookup.
hemaarvind1
Participant
Posts: 50
Joined: Mon Jan 21, 2008 9:35 am

Post by hemaarvind1 »

Thank you for your suggestion. How about the strings that mismatch in length?
ETLJOB
Participant
Posts: 87
Joined: Thu May 01, 2008 1:15 pm
Location: INDIA

Post by ETLJOB »

Did you try "trim" functions by any chance?
hemaarvind1
Participant
Posts: 50
Joined: Mon Jan 21, 2008 9:35 am

Post by hemaarvind1 »

I tried providing trim function,but as the condition is to be provided only on one input column , I could not compare for the other.

Like, For Source Table A and Lookup Table B, I can provide the trim condition on Lookup Stage for Table B. However, I can select only the columns of Source Table A for specifying condition,but I cannot specify condition for lookup table itself.

That is where I am getting stuck.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

If both are in same db (and preferably same schema), try something like

Code: Select all

SELECT Trim(Upper(a.DETAILS)) yourColumn
FROM source1 a
UNION
SELECT Trim(Upper(b.DETAILS)) yourColumn
FROM source2 b
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

You can always place a Transformer stage between the reference table and the LookUp stage and handle the trim in the Transformer stage.
Kris

Where's the "Any" key?-Homer Simpson
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

... or even a Modify stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Do a Inner join in the source with UPPER() and Trim function and then do a lookup in Datastage.
The first join in Database will ensure that, you get the Data from Source A only if it is present in Source B, and Vice versa. (You can change the join type if required.)
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply