OUT parameter

Поиск
Список
Период
Сортировка
От Daniel Caune
Тема OUT parameter
Дата
Msg-id 1E293D3FF63A3740B10AD5AAD88535D201D656B9@UBIMAIL1.ubisoft.org
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Function Parameters in GROUP BY clause cause errors
Следующее
От: "Owen Jacobson"
Дата:
Сообщение: Re: OUT parameter