From: | Adrian Klaver <aklaver(at)comcast(dot)net> |
---|---|
To: | Christine Penner <christine(at)ingenioussoftware(dot)com> |
Cc: | Postgres-General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Simple function |
Date: | 2009-12-23 17:14:38 |
Message-ID: | 717738732.4696411261588478975.JavaMail.root@sz0030a.emeryville.ca.mail.comcast.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
----- "Christine Penner" <christine(at)ingenioussoftware(dot)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(at)ingenioussoftware(dot)com>christine(at)ingenioussoftware(dot)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(at)comcast(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma | 2009-12-23 17:15:33 | Re: Simple function |
Previous Message | Christine Penner | 2009-12-23 17:03:01 | Simple function |