Re: PL/PgSQL - returning multiple columns ...

Поиск
Список
Период
Сортировка
От PFC
Тема Re: PL/PgSQL - returning multiple columns ...
Дата
Msg-id opslmvnew2th1vuj@musicbox
обсуждение исходный текст
Ответ на Re: PL/PgSQL - returning multiple columns ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
Список pgsql-sql
On Thu, 3 Feb 2005 12:48:11 -0400 (AST), Marc G. Fournier  
<scrappy@postgresql.org> wrote:

>
> Perfect, worked like a charm ... but the RETURNS still needs to be a  
> SETOF, other then that, I'm 'away to the races' ... thanks :)
No SETOF necessary :

CREATE TYPE mytype AS ( number INTEGER, blah TEXT );

CREATE OR REPLACE FUNCTION myfunc( INTEGER ) RETURNS mytype LANGUAGE  
plpgsql AS  $$ DECLARE _retval mytype; BEGIN _retval.number=$1;  
_retval.blah='yeah'; RETURN _retval; END;$$;

SELECT myfunc(22);  myfunc
----------- (22,yeah)
(1 ligne)

SELECT * FROM myfunc(22); number | blah
--------+------     22 | yeah
(1 ligne)


В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: problem with backup and restore (probaly stupit newb thing)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: problem with backup and restore (probaly stupit newb thing)