pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Can a function return a record set?
3+ messages / 3 participants
[nested] [flat]

* Can a function return a record set?
@ 2001-02-18 07:39 John Taves <jtaves@pickatime.com>
  2001-02-23 03:33 ` Re: Can a function return a record set? Jie Liang <jliang@ipinc.com>
  2001-02-23 15:34 ` Re: Can a function return a record set? Josh Berkus <josh@agliodbs.com>
  0 siblings, 2 replies; 3+ messages in thread

From: John Taves @ 2001-02-18 07:39 UTC (permalink / raw)
  To: pgsql-sql

Am I correct in concluding that I can't return a record set from a function?

For example, in MS SQL I would do:

create procedure foo as
select * from yada

I expected to be able to do the following in postgresql.

create function foo (integer) returns (integer) as '
begin
select * from yada;
end; '
language 'plpgsql';

I am concluding that I can't.

jt






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Can a function return a record set?
  2001-02-18 07:39 Can a function return a record set? John Taves <jtaves@pickatime.com>
@ 2001-02-23 03:33 ` Jie Liang <jliang@ipinc.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Jie Liang @ 2001-02-23 03:33 UTC (permalink / raw)
  To: John Taves <jtaves@pickatime.com>; +Cc: pgsql-sql

in plpgsql
you've to use
select field into a_variable from table where ...(single value return)
or 
for record|row in select fields from table loop
...
end loop;


Jie LIANG

St. Bernard Software
Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.stbernard.com
www.ipinc.com

On Sat, 17 Feb 2001, John Taves wrote:

> Am I correct in concluding that I can't return a record set from a function?
> 
> For example, in MS SQL I would do:
> 
> create procedure foo as
> select * from yada
> 
> I expected to be able to do the following in postgresql.
> 
> create function foo (integer) returns (integer) as '
> begin
> select * from yada;
> end; '
> language 'plpgsql';
> 
> I am concluding that I can't.
> 
> jt
> 
> 
> 




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Can a function return a record set?
  2001-02-18 07:39 Can a function return a record set? John Taves <jtaves@pickatime.com>
@ 2001-02-23 15:34 ` Josh Berkus <josh@agliodbs.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Josh Berkus @ 2001-02-23 15:34 UTC (permalink / raw)
  To: John Taves <jtaves@pickatime.com>; +Cc: pgsql-sql

Mr. Taves,

> Am I correct in concluding that I can't return a record
> set from a function?
> 
> For example, in MS SQL I would do:
> 
> create procedure foo as
> select * from yada
> 
> I expected to be able to do the following in postgresql.
> 
> create function foo (integer) returns (integer) as '
> begin
> select * from yada;
> end; '
> language 'plpgsql';
> 
> I am concluding that I can't.

You are correct.  Stored procedures that return rowsets are
in the "wish list" for 7.2 or 8.0 ... but not in the current
development version.  Please browse the archives (about 1-2
months ago) for my suggested workaround for the time being.

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-02-23 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-18 07:39 Can a function return a record set? John Taves <jtaves@pickatime.com>
2001-02-23 03:33 ` Jie Liang <jliang@ipinc.com>
2001-02-23 15:34 ` Josh Berkus <josh@agliodbs.com>

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