X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 84D4B9FB3DF for ; Thu, 31 Aug 2006 10:00:45 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 87305-05-2 for ; Thu, 31 Aug 2006 10:00:30 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) by postgresql.org (Postfix) with ESMTP id 765A49FB3C2 for ; Thu, 31 Aug 2006 10:00:15 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id m3so540261ugc for ; Thu, 31 Aug 2006 06:00:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=COijwS3F2tnlbql2Td1TdmoSu9K4PcvSN926dVLqQHv7otVeHq54Il6AYSoWnItARQ2p1o3hZEKRmY+633YvaEeIRA22O6ZNnaUP8cjAT5c5Z1hCZk5Rw22Xvz8m5h58qsytgYB45JhwVgikk/HFifdLzrzuLLCPtXXmaat3G2A= Received: by 10.66.220.17 with SMTP id s17mr497273ugg; Thu, 31 Aug 2006 06:00:12 -0700 (PDT) Received: by 10.67.118.11 with HTTP; Thu, 31 Aug 2006 06:00:12 -0700 (PDT) Message-ID: <55c095e90608310600y18d382f2l5cc43410466bbd79@mail.gmail.com> Date: Thu, 31 Aug 2006 10:00:12 -0300 From: "Ezequias Rodrigues da Rocha" To: pgsql-sql@postgresql.org Subject: ERROR: SELECT query has no destination for result data MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_59809_1705369.1157029212515" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.483 tagged_above=0 required=5 tests=AWL, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/244 X-Sequence-Number: 26202 ------=_Part_59809_1705369.1157029212515 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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=E2metros passados na fun=E7=E3o if Operacao <> 'C' then return 1; else select count(id) as numRegistros from base.emissor_ponto_venda where i= d =3D PontoVenda_Emissor; if numRegistros =3D 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: --=20 =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Atenciosamente (Sincerely) Ezequias Rodrigues da Rocha =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- A pior das democracias ainda =E9 melhor do que a melhor das ditaduras The worst of democracies is still better than the better of dictatorships http://ezequiasrocha.blogspot.com/ ------=_Part_59809_1705369.1157029212515 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi list,

I have a function like this:

Create OR REPLACE Function base.in= serirPontos(char(1), varchar(255), numeric(12,2), int8, int8, int8 ) return= s int4 as
$$
declare
    Operacao = alias for $1;
    Numero_nota alias f= or $2;
    Valor_not= a alias for $3;
    PontoVenda_Emisso= r alias for $4;
    Cardpass = alias for $5;
    Cx_Id alias for $6;=

begin<= /span>

-- Validando par=E2metros pa= ssados na fun=E7=E3o
  if Operacao <> 'C' then
  &nb= sp;  return 1;
   else

     select co= unt(id) as numRegistros from base.emissor_ponto_venda where id =3D PontoVen= da_Emissor;
     if = numRegistros =3D 0 then
=     &nbs= p;   return 2;        &nb= sp;
    &nbs= p; else
        i= nsert into base.pontos values (nextval('base.ponto_id'), now(), Operacao, N= umero_nota, Valor_nota, PontoVenda_Emissor, CartaoId(Cardpass), Cx_id);
        return 0= ;  
     end if;
  end if;
end
$$
 LANGUAGE 'plpgsql'<= br style=3D"font-family: arial,sans-serif;">
And I am getting the following result when I try to insert= using the function:


ERROR:  SELE= CT query has no destination for result data
HINT:  If you want to discard t= he results, use PERFORM instead.
CONTEXT:  PL/pgSQL function &q= uot;inserirpontos" line 17 at SQL statement

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

ps: =

--
=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
   &= nbsp;           &nbs= p;            &= nbsp;     Atenciosamente (Sincerely)
            = ;            Ez= equias Rodrigues da Rocha
=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-
A pior das democracias ainda =E9 melhor do que= a melhor das ditaduras
The worst of democracies is still better than th= e better of dictatorships
http://ezequiasrocha.bl= ogspot.com/ ------=_Part_59809_1705369.1157029212515--