Re: Returning more than one value from a stored procedure

Поиск
Список
Период
Сортировка
От Atif Jung
Тема Re: Returning more than one value from a stored procedure
Дата
Msg-id AANLkTimQSbAWZ2EdigMNutcA2KeKJc3M2UYZv_0l8xzz@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Returning more than one value from a stored procedure  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Ответы Re: Returning more than one value from a stored procedure  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-novice
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.
 
Many Thanks

Atif




On 8 July 2010 11:14, A. Kretschmer <andreas.kretschmer@schollglas.com> wrote:
In response to Atif Jung :
> Hi,
>  
> I'm having difficulty working out the correct syntax to return more than one
> value from a stored procedure. I wish to return an INTGER and a string
>  
> CREATE or REPLACE FUNCTION testproc(val1 (CHAR9), val2 CHAR(4)) RETURNS
> INTEGER, CHAR(640) AS $$
>  
> The above is incorrect but what is the correct syntax?
>  

You should use IN/OUT - Parameters, foro example:

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


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

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

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

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