for looping

From: "Michael Labhard" <ince(at)pacifier(dot)com>
To: pgsql-cygwin(at)postgresql(dot)org
Subject: for looping
Date: 2002-08-03 22:39:19
Message-ID: aihm1g$9u1$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

Does FOR LOOP work on SELECT? The following simple function looks good to
me but does not compile because of "missing .. at end of SQL expression".

CREATE FUNCTION get_all_diffs()
RETURNS FLOAT AS '
DECLARE
i INTEGER := 0;
sym_diff FLOAT := 0.0;

BEGIN
FOR row IN SELECT * FROM "tblTrades" LOOP
i := i+1;
END LOOP;

RETURN sym_diff;
END;'

LANGUAGE 'plpgsql'
;

SELECT get_all_diffs();

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Michael Adler 2002-08-04 17:36:55 Re: for looping
Previous Message Vanessa Martin 2002-08-01 11:29:11 What Are Your Financial Needs?