我得到了这个 Oracle 视图:
CREATE OR REPLACE VIEW "VALIDA_CADVEN_VIEW" ("SETOR_INI", "NOME_REP_INI", "RE_REP_INI", "TARGET_REP_INI", "SETOR_FIM", "NOME_REP_FIM",
"RE_REP_FIM", "TARGET_REP_FIM", "Situacao", "Causa") AS
SELECT I.SETOR, I.NOME_REP, I.RE_REP, I.TARGET_REP,
F.SETOR, F.NOME_REP, F.RE_REP, F.TARGET_REP, 'Não existe no arquivo atual' Situacao, 'Arquivo' Causa
FROM ZCADVEN_INI I
LEFT JOIN (SELECT * FROM ZCADVEN_FIM WHERE RE_REP IS NOT NULL ) f
ON I.RE_REP = F.RE_REP
WHERE F.RE_REP IS NULL
AND I.RE_REP IS NOT NULL
UNION
SELECT I.SETOR, I.NOME_REP, I.RE_REP, I.TARGET_REP,
F.SETOR, F.NOME_REP, F.RE_REP, F.TARGET_REP, 'Não existe no arquivo anterior' Situacao, 'Arquivo' Causa
FROM ZCADVEN_FIM F
LEFT JOIN (SELECT * FROM ZCADVEN_INI WHERE RE_REP IS NOT NULL ) I
ON I.RE_REP = F.RE_REP
WHERE I.RE_REP IS NULL
AND F.RE_REP IS NOT NULL
UNION
SELECT I.SETOR, I.NOME_REP, I.RE_REP, I.TARGET_REP,
F.SETOR, F.NOME_REP, F.RE_REP, F.TARGET_REP, 'Há divergências' Situacao, 'Target' Causa
FROM ZCADVEN_FIM F
INNER JOIN (SELECT * FROM ZCADVEN_INI WHERE RE_REP IS NOT NULL ) I
ON I.RE_REP = F.RE_REP
WHERE I.TARGET_REP <> F.TARGET_REP
UNION
SELECT I.SETOR, I.NOME_REP, I.RE_REP, I.TARGET_REP,
F.SETOR, F.NOME_REP, F.RE_REP, F.TARGET_REP, 'Há divergências' SITUACAO, 'Nome' CAUSA
FROM ZCADVEN_FIM F
INNER JOIN (SELECT * FROM ZCADVEN_INI WHERE RE_REP IS NOT NULL ) I
ON I.RE_REP = F.RE_REP
WHERE I.NOME_REP <> F.NOME_REP
UNION
SELECT I.SETOR, I.NOME_REP, I.RE_REP, I.TARGET_REP,
F.SETOR, F.NOME_REP, F.RE_REP, F.TARGET_REP, 'Há divergências' Situacao, 'Setor' Causa
FROM ZCADVEN_FIM F
INNER JOIN (SELECT * FROM ZCADVEN_INI WHERE RE_REP IS NOT NULL ) I
ON I.RE_REP = F.RE_REP
WHERE I.SETOR <> F.SETOR
UNION
SELECT I.SETOR, I.NOME_REP, I.RE_REP, I.TARGET_REP,
F.SETOR, F.NOME_REP, F.RE_REP, F.TARGET_REP, 'OK' Situacao, '-' Causa
FROM ZCADVEN_FIM F
INNER JOIN ZCADVEN_INI I
ON I.RE_REP = F.RE_REP
AND I.SETOR = F.SETOR
AND I.NOME_REP = F.NOME_REP
AND I.TARGET_REP = F.TARGET_REP
现在,在某些时候我需要做这个简单的事情SELECT
:
SELECT CAUSA FROM VALIDA_CADVEN_VIEW
我得到这个错误:
ORA-00904: "CAUSA": "%s: invalid identifier"
关于我做错了什么的任何想法?
谢谢你。