case condition

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
monaz
Participant
Posts: 98
Joined: Sat Aug 23, 2008 3:14 am

case condition

Post by monaz »

Hi,

I have an requirement in which i need to check the condition for multiple tables and populate for a single column.

Ex- I need to check
[if tableA.col1=tableB.col1 then tableB.col
else if tableA.Col1=tablec.Col1 then tablec.Col
else tableA.col] as newcolumn

I could write in the stored procedure only for one condition and populate from sybase sybase stage to the transformer, but could not proceed to check remaining condition
-
(when case tabA.col1=tableB.col1 then tableB.col else tableA.col end)as newcolumn

Can anyone guide me in resolving this issue.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Stream input from table A into Transformer stage, reference inputs from table B and table C. Construct your output column derivation expression according to your logic, remembering to take into account that the "not found" condition will return NULL.
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 »

I'm unsure why, assuming you've already made the checks, you don't use the syntax you posted? Your 'if-then-else' construct is perfectly valid and if that's really what you need, use it as the derivation.
-craig

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