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


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to