From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Returning more than one value from a stored procedure |
Date: | 2010-07-08 10:14:04 |
Message-ID: | 20100708101403.GH25665@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Atif Jung | 2010-07-08 10:20:57 | Re: Returning more than one value from a stored procedure |
Previous Message | Atif Jung | 2010-07-08 09:51:28 | Returning more than one value from a stored procedure |