Friday, September 17, 2021

ODI - mapping - hardcode data and case when in expression

UseCase: Here, we will have two tables. One source table has 2 columns Train id and name and 2nd target table has 3 columbs train id   name and city. We will hardcode city values using hardcode expression and case when expression.

Implementation Steps:

Step1: Project - mappings - new mappings - name as int_hardcode_data

Step2: Open the logical tab of mapping and drag and drop source and target tables. Map the train id and name.

Step3: Select city and open properties tab and write in the expression section: 'London'

Step4: Go to the physical tab and select IKM as IKM SQL insert default.

Select default and select LKM: LKM SQL to SQL

Step5: Save and run with simulation ok. Check the script.

Step6: Run now without simulation ok. Go to the operator tab and check Date today

Step7: Check your target database for records.


For case when:

Step1: Go to the logical tab of mapping and edit the city expression

Write:

Case 

When deafult:Regions.region_id =1 then 'London'

When deafult:Regions.region_id =2 then 'New York'

When deafult:Regions.region_id =3 then 'Tokyo'

When deafult:Regions.region_id =4 then 'Dubai'

END

Save and run again.


No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...