Search Postgresql Archives

Re: Function problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enrico wrote:
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.


minv.totale := totale;

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux