[firebase-br] sql com union all

Henery Linck Rosenhaim henery em multi-informatica.com.br
Qui Ago 25 15:11:38 -03 2005


muito obrigado pela force bruce... mas agora preciso de mais uma 
forcinha (acho q notaram q eu sou um tanto iniciante... = P)
uma outra query com union all... mas me retorna um outro erro... a única 
coisa que eu sei é que o problema está (teoricamente) no ultimo UNION da 
query... pois comentei bloco a bloco e com o ultimo comentado funcionou..
Obrigado pela ajuda...

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Invalid command.
Data type unknown.


SELECT EXTRACT(MONTH FROM CABEC.DEN_LEC) AS MES,
       CAST('ENTRADA' AS CHAR(7)) AS MOVIMENTO,
       CABEC.VAL_LEC   AS VALCONT,
       CONFNAT.DCA_CNL AS DESPRESAR,
       CAST('P' AS CHAR(1)) AS TIPO,
       (REF_LEC) AS LANC
FROM TBLEC CABEC LEFT JOIN
     TBCNL CONFNAT ON (CABEC.NAT_LEC = CONFNAT.NAT_CNL)
WHERE ( EXTRACT(YEAR FROM CABEC.DEN_LEC) = 2005 )
UNION ALL
SELECT EXTRACT(MONTH FROM CABEC.DEM_LSC) AS MES,
       CAST('SAIDA' AS CHAR(7)) AS MOVIMENTO,
       CABEC.VAL_LSC   AS VALCONT,
       CONFNAT.DCA_CNL AS DESPRESAR,
       CAST('P' AS CHAR(1)) AS TIPO,
       (REF_LSC) AS LANC
FROM TBLSC CABEC LEFT JOIN
     TBCNL CONFNAT ON (CABEC.NAT_LSC = CONFNAT.NAT_CNL)
WHERE ( CAN_LSC <> 'S' ) and
      ( EXTRACT(YEAR FROM CABEC.DEM_LSC) = 2005 )
UNION ALL
SELECT EXTRACT(MONTH FROM CABEC.DAT_ISS) AS MES,
       CAST('SERVIÇO' AS CHAR(7)) AS MOVIMENTO,
       CABEC.VAL_ISS AS VALCONT,
       CAST('' AS CHAR(6)) AS DESPRESAR,
       CAST('S' AS CHAR(1)) AS TIPO,
       (REF_ISS) AS LANC
FROM TBISS CABEC
WHERE ( EXTRACT(YEAR FROM CABEC.DAT_ISS) = 2005 )





Mais detalhes sobre a lista de discussão lista