Re: Returning more than one value from a stored procedure

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

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

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