Re: plpgsql function return array

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Karthikeyan Sundaram <skarthi98(at)hotmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: plpgsql function return array
Date: 2007-03-31 12:55:46
Message-ID: 20070331125546.GA23812@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

On Sat, Mar 31, 2007 at 12:43:44AM -0700, Karthikeyan Sundaram wrote:
> Hi, I am using Postgres 8.1.0. I have a requirement. I will
> create a function accepting few parameters. This will check into
> various tables and give back an array of values. I want to use the
> pgpsql block. I know that we can create using language sql. Is
> it possible to return an array from the function? Please guide me.

See the documentation for how to declare a function's return type,
how to return values from a function, and how to build and manipulate
arrays:

http://www.postgresql.org/docs/8.2/interactive/sql-createfunction.html
http://www.postgresql.org/docs/8.2/interactive/plpgsql-overview.html
http://www.postgresql.org/docs/8.2/interactive/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING
http://www.postgresql.org/docs/8.2/interactive/arrays.html
http://www.postgresql.org/docs/8.2/interactive/functions-array.html

If you're having a specific problem then please post the code you're
running and describe how its behavior differs from what you expect.

--
Michael Fuhr

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Abu Mushayeed 2007-04-01 13:59:36 max_fsm_pages
Previous Message Karthikeyan Sundaram 2007-03-31 07:43:44 plpgsql function return array

Browse pgsql-sql by date

  From Date Subject
Next Message Daniel CAUNE 2007-04-01 04:01:23 Sequence vs Serial
Previous Message Karthikeyan Sundaram 2007-03-31 07:43:44 plpgsql function return array