help using count in function

Поиск
Список
Период
Сортировка
От Michaud, Everett
Тема help using count in function
Дата
Msg-id 90727F03D504CE4E8CDB7F0F87330F65692077@miahcemail2.seqnt.com
обсуждение исходный текст
Ответы Re: help using count in function  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: help using count in function  (Michael Fuhr <mike@fuhr.org>)
Список 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

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

Предыдущее
От:
Дата:
Сообщение: psql question
Следующее
От: "Sample, Matt (GE Healthcare)"
Дата:
Сообщение: Bulk Loading into posgres 8.0.0