User function that returns a set of rows.

From: David Harel <hareldvd(at)gmail(dot)com>
To: postgres sql <pgsql-sql(at)postgresql(dot)org>
Subject: User function that returns a set of rows.
Date: 2010-05-24 18:33:35
Message-ID: 4BFAC67F.8050504@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)ergolight-sw(dot)com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joshua Tolley 2010-05-24 22:14:45 Re: User function that returns a set of rows.
Previous Message Louis-David Mitterrand 2010-05-24 17:11:22 Re: safely exchanging primary keys?