Re: Simple function

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Simple function
Дата
Msg-id 717738732.4696411261588478975.JavaMail.root@sz0030a.emeryville.ca.mail.comcast.net
обсуждение исходный текст
Ответ на Simple function  (Christine Penner <christine@ingenioussoftware.com>)
Список pgsql-general



----- "Christine Penner" <christine@ingenioussoftware.com> wrote:

> Hi,
>
> I'm trying to create a simple function but having a bit of trouble.
> This is what I want to do.
>
> I want to pass a key as a parameter (BKEY integer)
> the code in the function should be
> count(*) from F_BUILDINGS where B_PRIMARY_SEQ=BKEY
>
> I want to return the count from the select statement.
>
> Christine Penner
> Ingenious Software
> 250-352-9495
> <mailto:christine@ingenioussoftware.com>christine@ingenioussoftware.com
>

Something along lines of:

CREATE OR REPLACE FUNCTION public.count_test(integer)
 RETURNS bigint
 LANGUAGE sql
AS $function$
select count(*) from F_BUILDINGS where B_PRIMARY_SEQ=$1;
$function$



Adrian Klaver
aklaver@comcast.net

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

Предыдущее
От: Christine Penner
Дата:
Сообщение: Simple function
Следующее
От: Richard Broersma
Дата:
Сообщение: Re: Simple function