From: David Harel <hareldvd@gmail.com>
To: postgres sql <pgsql-sql@postgresql.org>
Subject: User function that returns a set of rows.
Date: Mon, 24 May 2010 21:33:35 +0300
Message-ID: <4BFAC67F.8050504@gmail.com> (raw)
Hi,
I'm struggling to write what seed at the time a simple function
like:
"CREATE FUNCTION foo() RETURNS IDONO as
$$
select * from tbl;
return (whatever that will give the *);
$$
up till now I got this far:
CREATE OR REPLACE FUNCTION select_business_types ()
RETURNS SETOF RECORD
AS
$body$
DECLARE
rec RECORD;
-- fields business_type_id business_type_name
BEGIN
FOR
rec IN SELECT * FROM sv_bo_business_types
LOOP
RETURN NEXT rec;
END LOOP;
RETURN;
END;
$body$
LANGUAGE 'plpgsql';
When I tried it from the shell I got a nasty error message about that I
am not in an environment to receive a set ??? (can't see it now. Office
restrictions).
Any idea?
--
Regards.
David Harel,
==================================
Home office +972 77 7657645
Cellular: +972 54 4534502
Snail Mail: Amuka
D.N Merom Hagalil
13802
Israel
Email: hareldvd@ergolight-sw.com
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: hareldvd@gmail.com
Subject: Re: User function that returns a set of rows.
In-Reply-To: <4BFAC67F.8050504@gmail.com>
* 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