Re: plpgsql: returning multiple named columns from function

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: John Lawler <postgresql(dot)org(at)tgice(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpgsql: returning multiple named columns from function
Date: 2005-08-23 19:36:54
Message-ID: 430B7AD6.3080105@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CREATE PROCEDURE test(

> @lookup char(50))
> WITH ENCRYPTION AS BEGIN
>
> -- ... a bunch of code to do some lookup, and then ...
>
> SELECT
> @Result1 AS Result1,
> @Result2 AS Result2,
> @Result3 AS Result3,
> @Result4 AS Result4
>
> END
> GO
>
> and then when I call this procedure, I get a result row (like it came
> from a SELECT on a table) which has the columns neatly labeled with
> 'Result1', 'Result2', etc. Note that these column labels are rather
> arbitrary and not necessarily associated with a single table or
> perhaps even any existing column in a table.

I think what you are looking for is SetOF functions.

http://www.postgresql.org/docs/8.0/interactive/functions-srf.html

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Lawler 2005-08-23 19:40:48 Re: plpgsql: returning multiple named columns from function
Previous Message John Lawler 2005-08-23 19:18:33 plpgsql: returning multiple named columns from function *simply*