From: Daniel Caune <daniel.caune@ubisoft.com>
To: pgsql-sql@postgresql.org
Subject: OUT parameter
Date: Wed, 22 Mar 2006 17:34:23 -0500
Message-ID: <1E293D3FF63A3740B10AD5AAD88535D201D656B9@UBIMAIL1.ubisoft.org> (raw)
Hi,
Is there any suggestion against using OUT parameter for local
calculation such as using a local variable?
CREATE OR REPLACE FUNCTION foo(a IN int,
b1 OUT int,
b2 OUT int)
AS $$
BEGIN
FOR (...) LOOP
b1 = (...);
b2 = (...);
END LOOP;
END;
$$ LANGUAGE PLPGSQL;
or for some reasons (performance or whatever other details of
implementation), would it be preferable to use local variable and to
initialize the OUT parameters at the end?
CREATE OR REPLACE FUNCTION foo(a IN int,
b1 OUT int,
b2 OUT int)
AS $$
V_b1 int;
V_b2 int;
BEGIN
FOR (...) LOOP
V_b1 = (...);
V_b2 = (...);
END LOOP;
b1 = V_b1;
b2 = V_b2;
END;
$$ LANGUAGE PLPGSQL;
Thanks,
--
Daniel CAUNE
Ubisoft Online Technology
(514) 4090 2040 ext. 5418
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: daniel.caune@ubisoft.com
Subject: Re: OUT parameter
In-Reply-To: <1E293D3FF63A3740B10AD5AAD88535D201D656B9@UBIMAIL1.ubisoft.org>
References: <1E293D3FF63A3740B10AD5AAD88535D201D656B9@UBIMAIL1.ubisoft.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox