Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 63 Insurance
- 536.4K On-Premises Infrastructure
- 138.3K Analytics Software
- 38.6K Application Development Software
- 5.8K Cloud Platform
- 109.5K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.3K Integration
- 41.6K Security Software
How to implement this logic in ODI 12c mapping?

Hi Experts,
I'm new to ODI 12c, but not new to ETL and Data warehousing.
I'm trying to create a mapping to update a couple of new columns added to an existing Dimension (SCD Type 2).
LOGIC: Each record in account dimension, check the Expiry Date and look for the last record loaded in staging table prior to that expiry date. Simplified example recordset gave below.
DIM_ACCOUNT
==============
record_no account_id effective_date expiry_date new_flag (NEW)
1 1234 08-AUG-10 17-APR-17 null
2 1234 17-APR-17 01-MAY-18 null
STAGING TABLE
==============
record_load_date account_id flag
16-OCT-11 1234 Y
19-JUL-14 1234 N
19-JUL-14 1234 Y
27-MAR-17 1234 N
How can I implement the above logic in ODI 12c mapping? Any help would be really helpful.
I already created a mapping by joining above two tables with ACCOUNT_ID and EXPIRY_DATE>=RECORD_LOAD_DATE.
But how I can implement another condition like..... AND EXPIRY_DATE = (SELECT MAX(RECORD_LOAD_DATE) from STAGING_TABLE WHERE ACCOUNT_ID=ACCOUNT_ID and EXPIRY_DATE>=RECORD_LOAD_DATE)
Thanks in advance.
Best Answer
-
Simplest way is to use ODI procedure.
If you want to implement using mappings create reusable mapping for this-
SELECT MAX(RECORD_LOAD_DATE) from STAGING_TABLE WHERE ACCOUNT_ID=ACCOUNT_ID and EXPIRY_DATE>=RECORD_LOAD_DATE)
Use aggregate component to get max(record_load_date).
Use this reusable mapping in the main mapping.
Note- Aggregate can be used in main mapping as well.
Please proceed as per your convenience.
Regards,
Pavan
Answers
-
Simplest way is to use ODI procedure.
If you want to implement using mappings create reusable mapping for this-
SELECT MAX(RECORD_LOAD_DATE) from STAGING_TABLE WHERE ACCOUNT_ID=ACCOUNT_ID and EXPIRY_DATE>=RECORD_LOAD_DATE)
Use aggregate component to get max(record_load_date).
Use this reusable mapping in the main mapping.
Note- Aggregate can be used in main mapping as well.
Please proceed as per your convenience.
Regards,
Pavan
-
Thanks for the feedback. Due to client preference, I cannot use a procedure and have to create a mapping.
So, If I use a Re-usable mapping component, I have to pass ACCOUNT_ID and RECORD_LOAD_DATE right?
-
Yes.
Regards,
Pavan
-
Thanks,its useful for me!