Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group