Reputation: 1
I need to remove PL/SQL code and convert that into ODI mapping. I tried using sub query to retrieve NOT EXISTS EVENT_MONTH_WID for EMPLID but now I am kind of stuck at next step on how to make next join with updated last value.
The process first checks for missing event_month_wid
values in the source table compared to the target table for each employee.
Then, it retrieves the last value from the source table before merging new data.
After that, the latest value for event_month_wid
is updated with the new data.
MERGE INTO wc_emp_tn_Serv_mnth_tmp x
using (
WITH mv_ef AS (
SELECT
e.person_integration_id AS emplid,
e.event_month_wid
FROM
w_wrkfc_evt_month_f e
WHERE
NOT EXISTS (
SELECT
1
FROM
wc_emp_tn_serv_mnth_tmp b
WHERE
e.event_month_wid = b.event_month_wid
AND e.person_integration_id = b.emplid
)
), lvf_mv AS (
SELECT
a.emplid,
b.event_month_wid,
LAST_VALUE(tn_serv_mnths) OVER(PARTITION BY a.emplid
ORDER BY
a.event_month_wid
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
) AS last_val_serv_mnths
FROM
wc_emp_tn_serv_mnth_tmp a,
mv_ef b
WHERE
a.emplid = b.emplid
AND a.event_month_wid < b.event_month_wid
)
SELECT DISTINCT
*
FROM
lvf_mv
)
y ON ( x.emplid = y.emplid
AND x.event_month_wid = y.event_month_wid )
WHEN MATCHED THEN UPDATE
SET x.tn_serv_mnths = y.last_val_serv_mnths
WHEN NOT MATCHED THEN
INSERT (
x.emplid,
x.event_month_wid,
x.tn_serv_mnths )
VALUES
( y.emplid,
y.event_month_wid,
y.last_val_serv_mnths );
I want to convert this code into ODI mapping
Upvotes: -3
Views: 33