Fórum Dúvida com código SQL #411237
05/01/2012
0
select Janeiro as mes, sum(cast (ne.total as numeric(10,2))) as Total_Vendas from notas_emitidas ne where extract (month from ne.data_emissao) = 1 and extract (year from ne.data_emissao) = :Ano union all select Fevereiro as mes, sum(cast (ne.total as numeric(10,2))) as Total_Vendas from notas_emitidas ne where extract (month from ne.data_emissao) = 2 and extract (year from ne.data_emissao) = :Ano union all select Março as mes, sum(cast (ne.total as numeric(10,2))) as Total_Vendas from notas_emitidas ne where extract (month from ne.data_emissao) = 3 and extract (year from ne.data_emissao) = :Ano group by 1, 2
ocorre o seguinte erro:
Dynamic SQL Error.
SQL error code = -104.
Invalid command.
Data type unknown.
o que tem de errado no meu SQL, quando executo cada select individualmente ele rola na boa!
Obrigado
Rafael Farias
Curtir tópico
+ 0Posts
10/01/2012
Eduardo Richeli
Gostei + 0
10/01/2012
Rafael Farias
=)
Gostei + 0
10/01/2012
Emerson Nascimento
select
(month from data_emissao) as mes,
cast(coalesce(sum(total),0) as numeric(10,2)) as Total_Vendas
from notas_emitidas
where extract (year from data_emissao) = :Ano
group by 1
Gostei + 0
11/01/2012
Eduardo Richeli
FOR SELECT xxxxx from tabela
INTO xxxxx DO
SUSPEND;
tem muitas documentaç~çoes na net sobre isto, basta pesquisar, abraços
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)