Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.1 kB
1
Indexable
Never
SELECT 'OFICIAL' ORIGEM, B.SEQNOTA, B.NROITEM, A.NROEMPRESA, A.DTAHORLANCTO
FROM RF_NOTAMESTRE A, RF_NOTAITEM B
WHERE A.SEQNOTA = B.SEQNOTA
AND A.DTAEMISSAO BETWEEN &dtaInicio AND &dtaFim
--AND A.NROEMPRESA = NVL(&nroEmpresa, A.NROEMPRESA)
--AND A.NRONOTA = NVL(&nroNota, A.NRONOTA)
AND A.ENTRADASAIDA = 'E'
AND A.ORIGEMDOCTO = 'N'
AND A.APPORIGEM IN (2, 9)
AND B.CODSTFCALC IN (SELECT ' ' FROM DUAL
UNION ALL
SELECT ' ' FROM DUAL
UNION ALL
SELECT A.LISTA
FROM MAX_ATRIBUTOFIXO A
WHERE A.TIPATRIBUTOFIXO = 'ORIGEMMERCADORIA')
UNION ALL
SELECT 'AUXILIAR' ORIGEM, B.SEQNOTA, B.NROITEM, A.NROEMPRESA, A.DTAHORLANCTO
FROM RF_AUXNOTAMESTR A, RF_AUXNOTAITEM B
WHERE A.SEQNOTA = B.SEQNOTA
AND A.DTAEMISSAO BETWEEN &dtaInicio AND &dtaFim
--AND A.NROEMPRESA = NVL(&nroEmpresa, A.NROEMPRESA)
--AND A.NRONOTA = NVL(&nroNota, A.NRONOTA)
AND A.ENTRADASAIDA = 'E'
AND A.ORIGEMDOCTO = 'N'
AND A.APPORIGEM IN (2, 9)
AND B.CODSTFCALC IN (SELECT ' ' FROM DUAL
UNION ALL
SELECT ' ' FROM DUAL
UNION ALL
SELECT A.LISTA
FROM MAX_ATRIBUTOFIXO A
WHERE A.TIPATRIBUTOFIXO = 'ORIGEMMERCADORIA')
ORDER BY 4, 5; ---1188 linhas
Leave a Comment