2009/12/17 marcos thomaz <[email protected]>:

> ERROR: syntax error at "tmp_table_tbg_01"
> SQL state: 42601
> Detail: Expected record variable, row variable, or list of scalar variables
> following INTO.
> Context: compile of PL/pgSQL function "ajustarptanual" near line 15
>
>
> A linha na procedure onde dá o erro é a seguinte:
> select coalesce(localidade,26) as localidade, coalesce(categoria,34) as
> categoria, refaaaamm, sum(valor) as valor into tmp_table_tbg_01 from
> func_valor_arrecadacao( vMes ) group by 1,2,3;

Altere para:
-- Se a tabela tmp_table_tbg_01 nao existe então crie:
CREATE TEMP TABLE tmp_table_tbg_01(
          localidade   TEXT
          categoria    TEXT
          refaaaamm TEXT
          valor           TEXT
);
-- Senao só altere a linha que deu erro por esta daqui:
INSERT INTO tmp_table_tbg_01
       SELECT coalesce(localidade,26)
                   , coalesce(categoria,34)
                   , refaaaamm, sum(valor) as valor
          FROM func_valor_arrecadacao(vMes)
        GROUP BY 1,2,3;


Abraço!

-Leo
-- 
Leonardo Cezar
http://www.aslid.org.br
http://postgreslogia.wordpress.com
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a