help using count in function

From: "Michaud, Everett" <EMichaud(at)sequoianet(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: help using count in function
Date: 2004-10-28 23:39:31
Message-ID: 90727F03D504CE4E8CDB7F0F87330F65692077@miahcemail2.seqnt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Perhaps this is simple, but it has me stumped. What is the data type to
use for returning a value from count?

Example:

CREATE FUNCTION ev3(int4) RETURNS int4
AS 'Select count(id) from events where id = $1;' LANGUAGE 'sql';

ERROR: return type mismatch in function declared to return integer

I've tried this with text, character, numeric, etc. Nothing seems to
work.

Any ideas?

Thanks,

Ev

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Karsten Hilbert 2004-10-29 07:22:42 Re: Question Regarding Locks
Previous Message Aleksandar Dezelin 2004-10-28 18:41:33 Importing Microsoft Sql Server 2000