Updating a table using a variable number of Update keys

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
Gokul
Participant
Posts: 74
Joined: Wed Feb 23, 2005 10:58 pm
Location: Mumbai

Updating a table using a variable number of Update keys

Post by Gokul »

Hi ,

The update strategy for an oracle table depends on existence of the fields in the source .

e.g if Fields A and B are present but c and D are absent then
update the table M set B := source.B, using A as key.

IF fields A and B are absent but C and D are present then
Update the table M set D := source.D , using C as key.

Can this be done in a single Oracle Stage?
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

I think this cannot be done in a single oracle stage ...Also ,Do you mean field absent is null value in that field ??
Nag
Gokul
Participant
Posts: 74
Joined: Wed Feb 23, 2005 10:58 pm
Location: Mumbai

Post by Gokul »

Yes.. The field been absent means it is NULL.
miwinter
Participant
Posts: 396
Joined: Thu Jun 22, 2006 7:00 am
Location: England, UK

Post by miwinter »

This isn't possible in a single stage, you'd need to have determined the logic ahead of DB operations and route accordingly with different update keys and requirements to seperate stages.
Mark Winter
<i>Nothing appeases a troubled mind more than <b>good</b> music</i>
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

Can't say if it is useful in your scenario, but you can use case statement in update query. and passing a flag from an upstream transformer can reduce the complexity.

I am not sure if you can put a case statement as argument of SET but you can give it a shot.

Else you can go for miwinter's suggestion.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Of course you can use a single stage, it's a single link you can't use. Just create a link for each combination needed and send your data down the correct one.
-craig

"You can never have too many knives" -- Logan Nine Fingers
miwinter
Participant
Posts: 396
Joined: Thu Jun 22, 2006 7:00 am
Location: England, UK

Post by miwinter »

Oracle stages must work differently to others then. As for DB2, you can't assign more than one stream input to it. Unless the OP should have actually posted in the correct forum.
Last edited by miwinter on Wed Jun 10, 2009 7:22 am, edited 1 time in total.
Mark Winter
<i>Nothing appeases a troubled mind more than <b>good</b> music</i>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps. Note that this is a Server answer, in which the OCI stage allows multiple inputs, it just means they must all connect to the same instance. PX doesn't allow it, however.
-craig

"You can never have too many knives" -- Logan Nine Fingers
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

This post was for server??? :shock:

I thought its for parallel, because of the forum!!

Moderator: Please move this to server forum.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well, it is marked as a Server job in the original post and more people tend to get that right than to post in the correct forum, it seems. :wink: We'll have to see what Gokul says.
-craig

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