Обсуждение: How do you return more than one variable in a plpgsql function?

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

How do you return more than one variable in a plpgsql function?

От
Mark Nielsen
Дата:
I have never figured out how to make a plpgsql function return more than 
one variable or type. I read something where a function an return an 
open cursor, but I never figured out how. I want a function to be able 
to return an entire row of a table or a number of fields from different 
tables using plpgsql.

How can I do that?
Thanks!
Mark



Re: How do you return more than one variable in a plpgsql function?

От
Vincent AE Scott
Дата:
Mark Nielsen(python@kepnet.net)@Thu, Feb 07, 2002 at 03:43:40PM -0500:
> I have never figured out how to make a plpgsql function return more than 
> one variable or type. I read something where a function an return an 
> open cursor, but I never figured out how. I want a function to be able 
> to return an entire row of a table or a number of fields from different 
> tables using plpgsql.
> 
> How can I do that?
> Thanks!
> Mark

i'm certainly no expert on postgres, but one option i can think of,
would be to insert the data into a 'temporary' table.  then return the
unique ID for that data.

certainly not perfect, but flexible.

HTH,
-vince

-- 
PGP key:  http://codex.net/pgp/pgp.asc
Computers make very fast, very accurate mistakes.