pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: 2000 Informatica <2000info@netsite.com.br>
To: PGSQL <pgsql-sql@postgresql.org>
Subject: Re: ERROR: SELECT query has no destination for result data
Date: Thu, 31 Aug 2006 10:51:43 -0300
Message-ID: <000c01c6cd04$98858bd0$2600a8c0@lap2000> (raw)
References: <55c095e90608310600y18d382f2l5cc43410466bbd79@mail.gmail.com>


Ezequias,

Declare a variavel  numRegistros dentro da funcao e altere o SELECT p/

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

q vai dar certo, OK ??


SPS
2000Info



  ----- Original Message ----- 
  From: Ezequias Rodrigues da Rocha 
  To: pgsql-sql@postgresql.org 
  Sent: Thursday, August 31, 2006 10:00 AM
  Subject: [SQL] ERROR: SELECT query has no destination for result data


  Hi list,

  I have a function like this:

  Create OR REPLACE Function base.inserirPontos(char(1), varchar(255), numeric(12,2), int8, int8, int8 ) returns int4 as 
  $$
  declare
      Operacao alias for $1;
      Numero_nota alias for $2;
      Valor_nota alias for $3;
      PontoVenda_Emissor alias for $4;
      Cardpass alias for $5;
      Cx_Id alias for $6; 

  begin

  -- Validando parâmetros passados na função

    if Operacao <> 'C' then
       return 1;
     else
       select count(id) as numRegistros from base.emissor_ponto_venda where id = PontoVenda_Emissor; 
       if numRegistros = 0 then
          return 2;          
        else
          insert into base.pontos values (nextval('base.ponto_id'), now(), Operacao, Numero_nota, Valor_nota, PontoVenda_Emissor, CartaoId(Cardpass), Cx_id); 
          return 0;   
       end if; 
    end if;
  end

  $$
   LANGUAGE 'plpgsql'

  And I am getting the following result when I try to insert using the function:

  select base.inserirPontos('C', '123456789', 12.5, 1, 9877000000944005, 104)


  ERROR:  SELECT query has no destination for result data
  HINT:  If you want to discard the results, use PERFORM instead.
  CONTEXT:  PL/pgSQL function "inserirpontos" line 17 at SQL statement 

  What I did wrong ? Any suggestion is quite good please.

  ps: 

  -- 
  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                                    Atenciosamente (Sincerely) 
                          Ezequias Rodrigues da Rocha
  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  A pior das democracias ainda é melhor do que a melhor das ditaduras
  The worst of democracies is still better than the better of dictatorships 
  http://ezequiasrocha.blogspot.com/ 


------------------------------------------------------------------------------


  No virus found in this incoming message.
  Checked by AVG Free Edition.
  Version: 7.1.405 / Virus Database: 268.11.7/434 - Release Date: 30/8/2006

view thread (5+ messages)  latest in thread

Message-ID: <000c01c6cd04$98858bd0$2600a8c0@lap2000>
Permalink:  ../000c01c6cd04$98858bd0$2600a8c0@lap2000/
Also on:    postgresql.org/message-id/000c01c6cd04$98858bd0$2600a8c0@lap2000

 · 

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: 2000info@netsite.com.br
  Subject: Re: ERROR: SELECT query has no destination for result data
  In-Reply-To: <000c01c6cd04$98858bd0$2600a8c0@lap2000>

* 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