ERROR: SELECT query has no destination for result data

From: "Ezequias Rodrigues da Rocha" <ezequias(dot)rocha(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: ERROR: SELECT query has no destination for result data
Date: 2006-08-31 13:00:12
Message-ID: 55c095e90608310600y18d382f2l5cc43410466bbd79@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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/

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message 2000 Informatica 2006-08-31 13:51:43 Re: ERROR: SELECT query has no destination for result data
Previous Message Christopher Browne 2006-08-31 03:08:12 Re: Create Assertion -- Question from a newbie