From: | "Daniel Caune" <daniel(dot)caune(at)ubisoft(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | OUT parameter |
Date: | 2006-03-22 22:34:23 |
Message-ID: | 1E293D3FF63A3740B10AD5AAD88535D201D656B9@UBIMAIL1.ubisoft.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Owen Jacobson | 2006-03-22 22:39:13 | Re: OUT parameter |
Previous Message | Tom Lane | 2006-03-22 21:53:48 | Re: [SQL] Function Parameters in GROUP BY clause cause errors |