Re: Returning more than one value from a stored procedure - Mailing list pgsql-novice

From A. Kretschmer
Subject Re: Returning more than one value from a stored procedure
Date
Msg-id 20100708101403.GH25665@a-kretschmer.de
Whole thread Raw
In response to Returning more than one value from a stored procedure  (Atif Jung <atifjung@gmail.com>)
Responses Re: Returning more than one value from a stored procedure
List 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 by date:

Previous
From: Atif Jung
Date:
Subject: Returning more than one value from a stored procedure
Next
From: Atif Jung
Date:
Subject: Re: Returning more than one value from a stored procedure