pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to return more than one variable from PgPlSQL procedure?
2+ messages / 2 participants
[nested] [flat]

* How to return more than one variable from PgPlSQL procedure?
@ 2002-03-22 12:34  Ivan Babikov <iab@qms.e-burg.ru>
  0 siblings, 1 reply; 2+ messages in thread

From: Ivan Babikov @ 2002-03-22 12:34 UTC (permalink / raw)
  To: pgsql-sql

Hello all,

I've noticed that postgres functions can return SETOF but it seems that
SETOF works only for sql-language functions. At least the code below is
compilable but causes freezing of pgAdmin during the execution. This
function was converted to PgPlSql from Interbase:

***************************************
CREATE FUNCTION "copy_node_sp_data"("int4", "int4") RETURNS SETOF sp_data AS
'
DECLARE INT_ID ALIAS FOR $1;
DECLARE NEW_PARENT ALIAS FOR $2;
DECLARE r RECORD;
BEGIN
 Select into r * from SP_DATA where ID=1;
 return r;
END;
***************************************

Actually, all I need is to return some integers.






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

* Re: How to return more than one variable from PgPlSQL procedure?
@ 2002-03-22 16:15  Richard Huxton <dev@archonet.com>
  parent: Ivan Babikov <iab@qms.e-burg.ru>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2002-03-22 16:15 UTC (permalink / raw)
  To: Ivan Babikov <iab@qms.e-burg.ru>; pgsql-sql

On Friday 22 Mar 2002 12:34, Ivan Babikov wrote:
> Hello all,
>
> I've noticed that postgres functions can return SETOF but it seems that
> SETOF works only for sql-language functions. At least the code below is
> compilable but causes freezing of pgAdmin during the execution. This
> function was converted to PgPlSql from Interbase:

Your assessment is correct, plpgsql cannot cope with SETOF at the moment. 
Version 7.2 allows you to return a cursor though (see the docs).

- Richard Huxton



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


end of thread, other threads:[~2002-03-22 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-03-22 12:34 How to return more than one variable from PgPlSQL procedure? Ivan Babikov <iab@qms.e-burg.ru>
2002-03-22 16:15 ` Richard Huxton <dev@archonet.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