Welcome, guest! Login / Register - Why register?
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_CLASS AS (
	SELECT A.PERIODO, 
	                A.RUC,
					M.CODSBS,
		           (SUBSTR(A.PERIODO,1,4)*12+SUBSTR(A.PERIODO,5,2))-((B.CODMES/100)*12+B.CODMES mod 100) AS DIF,
				   B.CTDENTIDADREPORTANTE, 
				   B.PCTNORMAL, 
				   B.PCTCPP, 
				   B.PCTDEFICIENTE, 
				   B.PCTDUDOSO, 
				   B.PCTPERDIDA
	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_RSK_FCT_MAECLASIFRCC B ON M.CODSBS=B.CODSBS AND 
			(SUBSTR(A.PERIODO,1,4)*12+SUBSTR(A.PERIODO,5,2)) - ((B.CODMES/100)*12+B.CODMES mod 100)>=2 AND
			(SUBSTR(A.PERIODO,1,4)*12+SUBSTR(A.PERIODO,5,2)) - ((B.CODMES/100)*12+B.CODMES mod 100)<=13
)
WITH DATA PRIMARY INDEX (PERIODO, RUC);

 

Revise this Paste

Your Name: Code Language: