Re: Plpgsql functions with output parameters

Поиск
Список
Период
Сортировка
От Leif B. Kristensen
Тема Re: Plpgsql functions with output parameters
Дата
Msg-id 200906041427.56493.leif@solumslekt.org
обсуждение исходный текст
Ответ на Plpgsql functions with output parameters  (Radcon Entec <radconentec@yahoo.com>)
Список pgsql-general
On Thursday 4. June 2009, Radcon Entec wrote:
>I have been beating my head against the documentation on plpgsql
> functions with output parameters for the last three hours, but I
> haven't been able to get them to work yet.
>
>
>I am playing with the sum_n_product function, taken from the
> doucmentation:
>
>-- Function: sum_n_product(integer, integer)
>-- DROP FUNCTION sum_n_product(integer, integer);
>CREATE OR REPLACE FUNCTION sum_n_product(IN x integer, IN y integer,
> OUT sum integer, OUT prod integer) RETURNS record AS
>$BODY$
>BEGIN
>    sum := x + y;
>    prod := x * y;
>END;
>$BODY$
>  LANGUAGE 'plpgsql' VOLATILE;
>
>If I go to a query window and execute "select sum_n_product(2, 3)", I
> get back "(2,3)".  I then wrote a function named "test_sum_n_product"
> to try to retrieve one of the numbers from inside the record (or
> whatever it is) that sum_n_product gave me.

Hint 1: SELECT * FROM sum_n_product(2, 3);

Hint 2: SELECT * FROM sum_n_product(2, 3) INTO foo;
--
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database: http://solumslekt.org/blog/

В списке pgsql-general по дате отправления:

Предыдущее
От: Geoffrey
Дата:
Сообщение: Re: warm standby with WAL shipping
Следующее
От: William Temperley
Дата:
Сообщение: Re: High I/O writes activity on disks causing images on browser to lag and not load