pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John DeSoi <desoi@pgedit.com>
To: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
Cc: PostgreSQL SQL List <pgsql-sql@postgresql.org>
Subject: Re: ERROR: SELECT query has no destination for result data
Date: Thu, 31 Aug 2006 10:26:10 -0400
Message-ID: <A970EDA9-C83F-4F15-B455-93CB54B2B8C4@pgedit.com> (raw)
In-Reply-To: <55c095e90608310707x52bd308cmc0319fab931d4b7@mail.gmail.com>
References: <55c095e90608310600y18d382f2l5cc43410466bbd79@mail.gmail.com>
	<F3D2085F-FDA7-4264-897A-385F7219DB21@pgedit.com>
	<55c095e90608310707x52bd308cmc0319fab931d4b7@mail.gmail.com>

Sorry, try

select into numRegistros count(*) from base.emissor_ponto_venda where  
id = PontoVenda_Emissor;

The thing you are selecting into needs to match what you are  
selecting. So in your examples below, record is needed when you use  
"* from ...". If you just need to look at one value:

select into num_em_pdv id from base.emissor_ponto_venda where id =  
PontoVenda_Emissor;


John


On Aug 31, 2006, at 10:07 AM, Ezequias Rodrigues da Rocha wrote:

> Thank you John,
>
> It only works using records. I don't know why.
>
> When I put ('works well'):
> select into num_em_pdv * from base.emissor_ponto_venda where id =  
> PontoVenda_Emissor;
>          if num_em_pdv.id is null then --> Se o emissor ponto venda  
> passado não tem na base retorne 4
>             retorno:= 4;
>
> When I put (don't works well):
>     num_em_pdv int4;
> select into num_em_pdv * from base.emissor_ponto_venda where id =  
> PontoVenda_Emissor;
>          if num_em_pdv.id is null then --> Se o emissor ponto venda  
> passado não tem na base retorne 4
>             retorno:= 4;
>
> Reports the error:
> ERROR:  missing FROM-clause entry for table "num_em_pdv"
> CONTEXT:  SQL statement "SELECT  num_em_pdv.id is null"
> PL/pgSQL function "inserirpontos" line 30 at if
>
> Thank you John. I think I should stay with the record type.



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL




view thread (5+ messages)

Message-ID: <A970EDA9-C83F-4F15-B455-93CB54B2B8C4@pgedit.com>
Permalink:  ../A970EDA9-C83F-4F15-B455-93CB54B2B8C4@pgedit.com/
Also on:    postgresql.org/message-id/A970EDA9-C83F-4F15-B455-93CB54B2B8C4@pgedit.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: desoi@pgedit.com, ezequias.rocha@gmail.com
  Subject: Re: ERROR: SELECT query has no destination for result data
  In-Reply-To: <A970EDA9-C83F-4F15-B455-93CB54B2B8C4@pgedit.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