OUT parameter - Mailing list pgsql-sql

From Daniel Caune
Subject OUT parameter
Date
Msg-id 1E293D3FF63A3740B10AD5AAD88535D201D656B9@UBIMAIL1.ubisoft.org
Whole thread Raw
List 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



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Function Parameters in GROUP BY clause cause errors
Next
From: "Owen Jacobson"
Date:
Subject: Re: OUT parameter