functions which return tuples - Mailing list pgsql-general

From Igor Roboul
Subject functions which return tuples
Date
Msg-id 20001027082342.A23496@linux.rainbow
Whole thread Raw
Responses Re: functions which return tuples  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello,

Is it possible write stored procedure (sorry, function) which will
return tuples one by one. Like:
    select * from my_func(1,2,3);
    1 Ivan
    2 Petr
    3 Irzi
etc.
Like in, for example, Interbase (this is completely unnatural proc):
create procedure find_something_for(p integer, w integer)
returns (k integer, t varchar(30) )
as
begin

for select n,v from t001 into :k,:t do
begin
  if(n>10) then suspend;
end

end

'suspend' will return result to caller and then execution will continue
from saved position.

This is needed when computations is much harder than comparision n and 10

--
Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga",
Sochi, Russia
http://www.brainbench.com/transcript.jsp?pid=304744

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.0 vs. 7.1 (was: latest version?)
Next
From: "Steve Wolfe"
Date:
Subject: Re: Postgres 7.0.2-2 on Red Hat 7.0?