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 SQL by registered user vvillacorta ( 3 years ago )
-- PASO 8: Generamos el universo de los clientes y sus representantes Legales
--DROP TABLE ......................LD_VECTOR_VPC_PERSONA;
CREATE MULTISET TABLE ......................LD_VECTOR_VPC_PERSONA
(DOCUMENTO_FINAL varchar(25),
RUC varchar(25),
TIPID_BDRELE varchar(25),
NUMID_BDRELE varchar(25)
) PRIMARY INDEX (DOCUMENTO_FINAL);
INSERT INTO ......................LD_VECTOR_VPC_PERSONA (
DOCUMENTO_FINAL,
RUC,
TIPID_BDRELE,
NUMID_BDRELE)
SELECT DISTINCT
X.DOCUMENTO_FINAL,
X.RUC,
D.TIPDOC TIPID_BDRELE,
D.CODDOC NUMID_BDRELE
FROM ......................LVL_VECTOR_VPC_4 X
LEFT JOIN ..........V_REP_LEGALES_SUNAT D ON D.NUMRUC = X.RUC
WHERE SUBSTR(TRIM(X.RUC),1,2) <> '10' AND D.CODDOC IS NOT NULL AND D.ESTADO = '0'
UNION
SELECT DISTINCT
X.DOCUMENTO_FINAL,
X.RUC,
D.TIPDOC TIPID_BDRELE,
D.CODDOC NUMID_BDRELE
FROM ......................LVL_VECTOR_VPC_4 X
LEFT JOIN ..........V_REP_LEGALES_SUNAT D ON D.NUMRUC = X.RUC
WHERE SUBSTR(TRIM(X.RUC),1,2) = '10' AND LENGTH(TRIM(X.RUC)) = 11;
Revise this Paste