Thread: plpgsql function return array

plpgsql function return array

From
Karthikeyan Sundaram
Date:
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.
 
 
Regards
skarthi



Take a break and play crossword puzzles - FREE! Play Now!

Re: plpgsql function return array

From
Michael Fuhr
Date:
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