I have a scalar function in my source database schema which I am using it to get balance of the specified account.
NVL(MYGL.F_GET_LAST_ACC_BALANCE(ACCOUNTS.ACC_NO, TRUNC(SYSDATE), 1),0)
In ODI mapping I would like to use this function to get balance of the accounts and then load them into my DWH DB.
I am using IKM Oracle Insert with DbLink.
I tried to use EXPRESSION inside mapping however that didn't give me the result because ODI tries to execute MYGL.F_GET_LAST_ACC_BALANCE
on DWH
side not on the source side. MYGL.F_GET_LAST_ACC_BALANCE
is defined in Source DB.
This is the generated query
INSERT
/*+ APPEND PARALLEL */
INTO DWH.FACT_ACCOUNTS
(
REPORT_DATE ,
ACC_NO ,
ACC_PROD_CODE ,
REAL_BALANCE ,
LAST_BALANCE
)
SELECT
TRUNC(SYSDATE) ,
ACCOUNTS.ACC_NO ,
ACCOUNTS.ACC_PROD_CODE ,
ACCOUNTS.ACC_BALANCE ,
(NVL(MYGL.F_GET_LAST_ACC_BALANCE(ACCOUNTS.ACC_NO, TRUNC(SYSDATE), 1),0))
FROM
<schema>.<table>@<dblink_to_source> ACCOUNTS
What it needs to be
INSERT
/*+ APPEND PARALLEL */
INTO DWH.FACT_ACCOUNTS
(
REPORT_DATE ,
ACC_NO ,
ACC_PROD_CODE ,
REAL_BALANCE ,
LAST_BALANCE
)
SELECT
TRUNC(SYSDATE) ,
ACCOUNTS.ACC_NO ,
ACCOUNTS.ACC_PROD_CODE ,
ACCOUNTS.ACC_BALANCE ,
(NVL(MYGL.F_GET_LAST_ACC_BALANCE@<dblink_to_source>(ACCOUNTS.ACC_NO, TRUNC(SYSDATE), 1),0))
FROM
<schema>.<table>@<dblink_to_source> ACCOUNTS