user524707
user524707

Reputation: 129

I have an informatica code.I want to have an equivalent of the same in oracle query

IIF(Col1=1, DAT1, IIF(Col2=1, DAT2, IIF(col3=1, DAT3, IIF(Col4=1, DAT4)))) 

The above is the informatica piece of code

How do i convert this in oracle

case when col1=1 then data1
 else
 case when col2=1 then data2)

I have tried something like this.But i am not sure .Please suggest me on how to convert

Upvotes: 0

Views: 345

Answers (1)

Marek Grzenkowicz
Marek Grzenkowicz

Reputation: 17353

You don't need multiple, nested CASE statements, one is enough:

CASE
  WHEN Col1=1 THEN DAT1
  WHEN Col2=1 THEN DAT2
  WHEN Col3=1 THEN DAT3
  WHEN Col4=1 THEN DAT4
END

Upvotes: 1

Related Questions