Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as Plain Text by registered user vvillacorta ( 3 years ago )
CREATE MULTISET TABLE .........................................................HM_CIMA_RCC_1 AS (
SELECT A.PERIODO, A.RUC, M.CODSBS,
(SUBSTR(A.PERIODO,1,4)*12+SUBSTR(A.PERIODO,5,2)) - ((B.Periodo_Val/100)*12+B.Periodo_Val mod 100) AS DIF,
B.Cuenta_RCC_Val,
B.Condicion_Val,
B.Clasificacion_Deudor_Cd,
B.Saldo_Amt,
B.Flg_Lin_Mercado,
B.empresa_cd,
B.TipoEmpresaFinanc_Id,
C.Tipo_Producto_RCC_cd,
C.Producto_RCC_cd,
C.Situacion_RCC_cd
FROM ............................................TABLA_BASE_DE_IBK_DATA A
LEFT JOIN ..........................V_RSK_FCT_MAEPERSONA_RCC M
ON A.RUC = (CASE WHEN M.NUMDOCTRIB IS NULL OR M.NUMDOCTRIB='.' OR M.NUMDOCTRIB LIKE '' THEN M.NUMDOCTRIB_TRDT ELSE M.NUMDOCTRIB END)
LEFT JOIN ...........................V_VPC_FACT_SALDOS_RCC B
ON M.CODSBS = B.Cod_SBS_Val AND
(SUBSTR(A.PERIODO,1,4)*12+SUBSTR(A.PERIODO,5,2)) - ((B.Periodo_Val/100)*12+B.Periodo_Val mod 100) >= 2 AND
(SUBSTR(A.PERIODO,1,4)*12+SUBSTR(A.PERIODO,5,2)) - ((B.Periodo_Val/100)*12+B.Periodo_Val mod 100) <= 25
LEFT JOIN .........................................V_DIM_VPC_CTA_CTBLE_RCC C
ON B.Cuenta_RCC_Val=C.Cuenta_Ctble_RCC_Cd
)
WITH DATA PRIMARY INDEX (PERIODO, RUC);
Revise this Paste