create function problem

Поиск
Список
Период
Сортировка
От Thomas Leung
Тема create function problem
Дата
Msg-id BAY8-F86Mma0n7J95K700001d87@hotmail.com
обсуждение исходный текст
Ответы Re: create function problem
Re: create function problem
Список pgsql-admin
I want to index my table using the year of the date. So I create the
following function.

create function to_year(date) returns varchar as '
declare
  str varchar;
  begin
    str := to_char($1, "YYYY");
    return str;
  end;
' language 'plpgsql' with (iscachable, isstrict);

But I face the problem as follow
select to_year(current_date);
WARNING:  Error occurred while executing PL/pgSQL functions to_year
WARNING:  line 4 at assignment
ERROR:  Attribute "YYYY" not found

Anybody can help? Thanks.

_________________________________________________________________
Linguaphone :  Learning English? Get Japanese lessons for FREE
http://go.msnserver.com/HK/30476.asp


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

Предыдущее
От: alvaro@audifarma.com.co
Дата:
Сообщение: SOS ---- Could you help me with postgresql.....????
Следующее
От: "Mark M. Huber"
Дата:
Сообщение: backup and recovery