Re: Returning more than one value from a stored procedure

From: Atif Jung <atifjung(at)gmail(dot)com>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Returning more than one value from a stored procedure
Date: 2010-07-08 10:20:57
Message-ID: AANLkTimQSbAWZ2EdigMNutcA2KeKJc3M2UYZv_0l8xzz@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)kretschmer(at)schollglas(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tim Landscheidt 2010-07-08 10:49:44 Re: Returning more than one value from a stored procedure
Previous Message A. Kretschmer 2010-07-08 10:14:04 Re: Returning more than one value from a stored procedure