'Decode Function in Informatica

Can anyone please help me to write a decode function in Informatica for the below case statement?

CASE WHEN Employee in ('210','220','230') and Score like '7%' THEN concat(SUBSTRING(Employee,1,2),'2')

WHEN Employee in ('210','220','230') and Score not like '7%' THEN concat(SUBSTRING(Employee,1,2),'1')

ELSE Employee END as New_Employee

Thanks!!



Solution 1:[1]

You can use decode to test out multiple conditions like CASE WHEN. It works exacly like case when.

DECODE( TRUE,
        Employee in ('210','220','230') and substr(Score,1,1) = '7', concat(substr(Employee,1,2),'2') ,
        Employee in ('210','220','230') and substr(Score,1,1) <>'7',concat(substr(Employee,1,2),'1'), 
Employee )

So, it will check if first condition is true, if yes it will exit else check second, if true, it will exit and so on ...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1