Wednesday, January 30, 2013

Difference between Decode and IIF in Informatica?


DECODE

IIF

Decode can be used in Select statement

IIF cannot be used in a Select statement.

EXAMPLE:
DECODE(deptname,"SALES",1,0)
----If DEPTNAME is SALES then return 1 else return zero
EXAMPLE:
IIF( GRADE > 1, IIF( GRADE < 2, SAL1, IIF( GRADE < 3, SAL2, IIF( GRADE < 4, SAL3, BONUS))), 0 )
----If the GRADE less than ONE then return zero else return SAL1 OR SAL2 OR SAL3 OR BONUS

Decode gives better readability to users

IIF does not give good readability

No comments:

Post a Comment

Thank you :
- kareem