Re: Returning more than one value from a stored procedure

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: Returning more than one value from a stored procedure
Дата
Msg-id 20100708111340.GI25665@a-kretschmer.de
обсуждение исходный текст
Ответ на Re: Returning more than one value from a stored procedure  (Atif Jung <atifjung@gmail.com>)
Список pgsql-novice
In response to Atif Jung :
> Thanks Andreas but is there no alternative?
>  
> I'm porting from an INFORMIX database which allows the return of more than one
> value from a stored procedure without having to use in/out parameters. The
> procedure is called from several places across the system and will be time
> consuming to change all instances to include the new out parameters. To be able
> to return more than one parameter will be of great help to me, if it's
> possible.

Other solution, but new problem for you:

test=# create or replace function atif(int, text) returns record as
$$declare r record; begin select into r 1::int, 'hello world'::text; return r; end;$$language plpgsql;
CREATE FUNCTION
test=*# select * from atif (0,'test') as foo(a int, b text);
 a |      b
---+-------------
 1 | hello world
(1 row)

test=*# select * from atif (0,'test');
ERROR:  a column definition list is required for functions returning "record"
LINE 1: select * from atif (0,'test');


Now you have to define the result-type later, but you have to define
that.

Regards, Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

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

Предыдущее
От: Tim Landscheidt
Дата:
Сообщение: Re: Returning more than one value from a stored procedure
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: Returning more than one value from a stored procedure