outer join two tables in seperate databases

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
battleboy1
Participant
Posts: 24
Joined: Fri Nov 25, 2005 4:16 pm

outer join two tables in seperate databases

Post by battleboy1 »

Hi,

i have two tables, primary in oracle and reference table in SQL server. i want to perform outer(left or right or full) on these tables in server jobs.
can anyone explain how to do this. i cannot move any of the tables into other schema or database. and can i specify anything in the transformer which makes the current equii join into outer join?
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

A normal join in a DataStage job is an outer join. The transformer simply outputs nulls onto the join fields where a lookup match is not found, you can add null handling to your output derivation fields to default values where a join is not found or leave them as null.
battleboy1
Participant
Posts: 24
Joined: Fri Nov 25, 2005 4:16 pm

Post by battleboy1 »

i read that transformer performs equii join. and even in the job it is performing equii join. is anything that i can specify to make it a left or right or full outer or inner depending on what the result should be?
chinek
Participant
Posts: 75
Joined: Mon Apr 15, 2002 10:09 pm
Location: Australia

Post by chinek »

battleboy1 wrote:i read that transformer performs equii join. and even in the job it is performing equii join. is anything that i can specify to make it a left or right or full outer or inner depending on what the result should be?
Nope the default is an outer join, you can make it an equi join by putting in contraints.
battleboy1
Participant
Posts: 24
Joined: Fri Nov 25, 2005 4:16 pm

Post by battleboy1 »

HOW TO DO LEFT OR RIGHT JOIN?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No shouting please.

Do you mean a left or a right outer join? As noted, with a hashed file holding the 'outer' side. Any hashed lookup miss will return nulls for all looked up columns. Turn it into an inner join by using a contraint to filter out the rows where the join returns nulls.
-craig

"You can never have too many knives" -- Logan Nine Fingers
battleboy1
Participant
Posts: 24
Joined: Fri Nov 25, 2005 4:16 pm

Post by battleboy1 »

hey sorry guys.

i am not being rude. i just forgot to switch my capslock off.
battleboy1
Participant
Posts: 24
Joined: Fri Nov 25, 2005 4:16 pm

Post by battleboy1 »

the problem is the driving table is in oracle and the secondary or lookup is in sql server. so the outer is on the table in oracle or the driving table so that i do no want to miss any columns which are not matched in the look up table. if matched then get the data from lookup also. i hope you guys understood the prob.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

You need to switch your job around making Oracle the reference link and SQL Server the primary link. Server jobs do not let your use right outer joins though parallel jobs do.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It is provable that A LEFT OUTER JOIN B is the same as B RIGHT OUTER JOIN A - on this basis some query tools either don't bother to provide right outer join functionality, or transparently rewrite right outer joins as left outer joins. And why not?

So heed the advice about swapping your driver and probe tables in order to achieve your desired outer join in DataStage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Which is exactly what I meant when mentioning that the 'outer' side was held in the hashed file. So, as noted, swap it around to switch from one to the other.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply