pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nagy Tamas <nthomas@cs.bme.hu>
To: pgsql-sql@postgresql.org
Subject: looping through results of a SELECT
Date: Sat, 27 Jan 2001 20:15:42 +0100
Message-ID: <20010127201542.A1794@cs.bme.hu> (raw)

Hello!

	I'd like to write a function, that makes some calculations
(perhaps applies another function) on every row of a result set returned
by a SELECT query. I thought writing a WHILE loop would work, but I
couldn't assign the individual rows to a variable. Then, I read about the
FETCH command, and I tried to use that, but it dies with 'error
near CURSOR' error when I try to use the function. I wrote a PL/PGSQL
function, obviously. So, my question is: is there an easy way to assign
the individual rows of a SELECT result to a variable in a function?
Thanks in advance,
Thomas Nagy



view thread (2+ messages)  latest in thread

Message-ID: <20010127201542.A1794@cs.bme.hu>
Permalink:  ../20010127201542.A1794@cs.bme.hu/
Also on:    postgresql.org/message-id/20010127201542.A1794@cs.bme.hu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: nthomas@cs.bme.hu
  Subject: Re: looping through results of a SELECT
  In-Reply-To: <20010127201542.A1794@cs.bme.hu>
  References: <20010127201542.A1794@cs.bme.hu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox