pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vibhor Kumar <vibhor.kumar@enterprisedb.com>
To: pgsql.sql@googlegroups.com
Cc: pgsql-sql@postgresql.org
Subject: Re: what's wrong in this procedure?
Date: Tue, 1 Mar 2011 13:26:34 +0530
Message-ID: <AD4D4ED1-BC32-4799-A987-CAF2A3CA5663@enterprisedb.com> (raw)
In-Reply-To: <080608d1-b5ea-4b40-8042-f21867f97cc8@glegroupsg2000goo.googlegroups.com>
References: <080608d1-b5ea-4b40-8042-f21867f97cc8@glegroupsg2000goo.googlegroups.com>


On Feb 25, 2011, at 11:16 PM, Camaleon wrote:

> This error is returned Erro de SQL:
> 
> ERROR:  column "Aguardando Pagto" does not exist at character 352  >>>
> 
> 
> create or replace function get_historico()   RETURNS SETOF twiste.type_cur__historico AS '
> 
>   SELECT o.data_fim, sum(t.num_itens * t.valor) AS total, count(t.*) AS transacoes
>   FROM ofertas o
>   JOIN transacao t ON o.ofertas_id = t.ofertas_id
>   JOIN municipio m ON o.municipio_id = m.municipio_id
>  WHERE  o.data_fim <= now() AND t.status IN("Aguardando Pagto", "Em anĂ¡lise", "Aprovado", "Completo")
>  GROUP BY o.data_fim;
> '
> language 'sql';


try Following:
create or replace function get_historico()   RETURNS SETOF twiste.type_cur__historico AS $$

  SELECT o.data_fim, sum(t.num_itens * t.valor) AS total, count(t.*) AS transacoes
  FROM ofertas o
  JOIN transacao t ON o.ofertas_id = t.ofertas_id
  JOIN municipio m ON o.municipio_id = m.municipio_id
 WHERE  o.data_fim <= now() AND t.status IN('Aguardando Pagto', 'Em anĂ¡lise', 'Aprovado', 'Completo')
 GROUP BY o.data_fim;
$$
language 'sql';

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
vibhor.kumar@enterprisedb.com
Blog:http://vibhork.blogspot.com




view thread (5+ messages)

Message-ID: <AD4D4ED1-BC32-4799-A987-CAF2A3CA5663@enterprisedb.com>
Permalink:  ../AD4D4ED1-BC32-4799-A987-CAF2A3CA5663@enterprisedb.com/
Also on:    postgresql.org/message-id/AD4D4ED1-BC32-4799-A987-CAF2A3CA5663@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: vibhor.kumar@enterprisedb.com, pgsql.sql@googlegroups.com
  Subject: Re: what's wrong in this procedure?
  In-Reply-To: <AD4D4ED1-BC32-4799-A987-CAF2A3CA5663@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox