Lookup

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Lookup

Post by sheema »

I have a job where i have an oracle source Tbl1 and i need to do an lookup with another oracle table Tbl2. But instead of using a hash file,i
would like to use a custom sql and join them.
so i am doing an left outer join.But i see that i get more no of records than the no.of records in Tbl1.Since i am doing an left outer join,i should be replicating the functionality of a Lookup.Am i right.
urshit_1983
Participant
Posts: 73
Joined: Wed Jun 28, 2006 3:27 pm
Location: NJ

Post by urshit_1983 »

As you are doing Left outer join its going to take all records of left table i.e TBL1 and only matching records from TBL2 based upon the key.

Instead as you want to do look up you can use TBL2 for lookup directly instead of hashed file, no need to join.
"Nobody is expert in Everything,
But Everybody is expert in Something."
sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Post by sheema »

I thougt instead of using the Tbl2 as lookup the performance would be better if i do a left outer join.
madhukar
Participant
Posts: 86
Joined: Fri May 20, 2005 4:05 pm

Post by madhukar »

[quote="sheema"]I thougt instead of using the Tbl2 as lookup the performance would be better if i do a left outer join.[/quote]

Check for duplicates. if both the files has duplicates then left outer join produces more rows.
sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Post by sheema »

yes,i see that i am getting more no of rows in left outer join than the no .of records in Tbl1.That means there are duplicates.In this case,which option is to be used.
urshit_1983
Participant
Posts: 73
Joined: Wed Jun 28, 2006 3:27 pm
Location: NJ

Post by urshit_1983 »

from TBL1 while you are selecting and writing custom SQL use "DISTINCT" and in where clause use "GROUP BY" then the key you are using for join.
"Nobody is expert in Everything,
But Everybody is expert in Something."
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you WANT the duplicates, do nothing. A simple left outer join will deliver all the duplicates from Tbl1, and mimic the behaviour of DataStage lookup. If you want to remove the duplicates, then an approach such as an inner self-join with the distinct key values would suffice.
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