Function problem

From: Enrico <scotty(at)linuxtime(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Function problem
Date: 2008-02-22 16:10:16
Message-ID: 20080222171016.af7d28c3.scotty@linuxtime.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,
I have this piece of code

DECLARE
minv my_inv;
r record;
totale numeric(20,5);
valore numeric(20,5);
BEGIN

[.........]

totale := 0;
for r in select * from tminv loop
[.........]
valore := r.prezzo*r.giacenza;
totale := totale+valore;
minv.totale = totale;
return next minv;
end loop;
return;
[......]

So
the first record has valore=98 and totale=0 for the first time of
the loop, but my first result of totale is -298 instead of +98.

Any suggestion?

Thanks

Regards
Enrico
--
One small feel for man, one giant ass for mankind (Dr. Gregory House)

Enrico Pirozzi
Web: http://www.enricopirozzi.info
E-Mail: info(at)enricopirozzi(dot)info
Skype: sscotty71

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Justin 2008-02-22 16:10:20 Re: need some help on figuring out how to write a query
Previous Message Daniel Verite 2008-02-22 16:05:21 Re: Selecting large objects stored as bytea