Skip site navigation (1) Skip section navigation (2)

accumulate setof ?

From: Bo Lorentsen <bl(at)netgroup(dot)dk>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: accumulate setof ?
Date: 2001-09-11 07:43:49
Message-ID: 3B9DC0B5.BAD49964@netgroup.dk (view raw or flat)
Thread:
Lists: pgsql-novice
Hi ...

I have tried to make a plgpsql function that accumulate a set of
integers, but I find no way of doing this in the PostgreSQL
documentation. I have made a very simple example to demonstrate my
problem :

CREATE FUNCTION fn_integer_list( INTEGER )
RETURNS SETOF INTEGER AS '
DECLARE
  SETOF INTEGER res;
BEGIN
  res := 1;
  res := res + $1;
  RETURN res;
END'
LANGUAGE 'plpgsql';

There is really two problems here. How does one initialize a set of
integers, and how does one append a new value to the setof integers ?
This example does, of course, not work :-)

If there is a reference to some documentation I should read, I will be
happy for any hint in its direction.

/BL

Responses

pgsql-novice by date

Next:From: Jason TanDate: 2001-09-12 06:51:49
Subject: Re: accumulate setof ?
Previous:From: Jason TanDate: 2001-09-11 05:30:06
Subject: Re: Path for pgsql \i option?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group