Обсуждение: How to return more than one variable from PgPlSQL procedure?

Поиск
Список
Период
Сортировка

How to return more than one variable from PgPlSQL procedure?

От
"Ivan Babikov"
Дата:
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;
BEGINSelect into r * from SP_DATA where ID=1;return r;
END;
***************************************

Actually, all I need is to return some integers.





Re: How to return more than one variable from PgPlSQL procedure?

От
Richard Huxton
Дата:
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