SELECT C1.BNK_ID_NBR ,L.LANGUAGE_CD ,' ' ,L.DESCR , CFG.CURRENCY_CD FROM PS_BANK_BAL_DAILY D LEFT OUTER JOIN PS_BANK_CD_TBL C1 ON D.BNK_ID_NBR = C1.BNK_ID_NBR , PS_BANK_CD_LNG L ,PS_TR_BNK_DISP_CUR CFG ,PS_RT_RATE_TBL RATE ,PS_CURRENCY_CD_TBL CUR WHERE L.SETID=C1.SETID AND L.BANK_CD=C1.BANK_CD AND D.CURRENCY_CD = RATE.FROM_CUR AND CFG.CURRENCY_CD = RATE.TO_CUR AND RATE.TERM = 0 AND CFG.OPRID = %OperatorId AND CFG.RT_TYPE = RATE.RT_TYPE AND CFG.RT_RATE_INDEX = RATE.RT_RATE_INDEX AND RATE.EFFDT = ( SELECT MAX(EFFDT) FROM PS_RT_RATE_TBL R WHERE D.CURRENCY_CD = R.FROM_CUR AND CFG.CURRENCY_CD = R.TO_CUR AND R.TERM = 0 AND CFG.OPRID = %OperatorId AND CFG.RT_TYPE = R.RT_TYPE AND CFG.RT_RATE_INDEX = R.RT_RATE_INDEX AND R.EFFDT <= %CurrentDateIn) AND CUR.CURRENCY_CD = RATE.TO_CUR AND CUR.EFFDT = ( SELECT MAX(C2.EFFDT) FROM PS_CURRENCY_CD_TBL C2 WHERE C2.CURRENCY_CD = CUR.CURRENCY_CD AND C2.EFFDT <= %CurrentDateIn ) GROUP BY C1.BNK_ID_NBR,L.LANGUAGE_CD, L.DESCR , CFG.CURRENCY_CD, CUR.DECIMAL_POSITIONS
|