dates in functions

Поиск
Список
Период
Сортировка
От Salvador Mainé
Тема dates in functions
Дата
Msg-id 3A9FB338.A5A174C9@yahoo.com
обсуждение исходный текст
Список pgsql-sql
Hello:

I'm trying to define a function that, given a date, returns its month.
The definition is as follows:

CREATE function anyo_hidro (date) returns int AS '      BEGIN      RETURN date_part("month",$1);      END;
' LANGUAGE 'plpgsql';


But when I do:

select anyo_hidro('1-1-1999');

I get the following error:

ERROR:  Attribute 'month' not found

Why doesn't date_part work with pl/sql functions?


Thanks 

-- 
Salvador Maine
http://www.ronincoders.com


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

Предыдущее
От: Salvador Mainé
Дата:
Сообщение: Re: dates in functions
Следующее
От: Sondaar Roelof
Дата:
Сообщение: RE: Help creating rules/triggers/functions