Re: syntax for using function parameter in to_char

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: syntax for using function parameter in to_char
Дата
Msg-id web-682424@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на syntax for using function parameter in to_char  (Kevin Barrett <anon000000@hotmail.com>)
Список pgsql-sql
Kevin,

> CREATE FUNCTION java_date( bigint ) RETURNS text AS '
>     select to_char(\'epoch\'::datetime + \'$1 seconds\'::interval, 
> \'dd/mm/yyyy hh:mi\') as RESULT
>   '
>   LANGUAGE 'sql';

Try this instead:
CREATE FUNCTION java_date( bigint ) RETURNS text AS '      select to_char(''epoch''::datetime +              (CAST($1
ASVARCHAR) || ''seconds'')::interval,               ''dd/mm/yyyy hh:mi'') as RESULT
 
'
LANGUAGE 'sql';

Got it?  Check, though, a "CAST (bigint as varchar)" may or may notwork.

-Josh



______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_vlock / vacuum
Следующее
От: Tom Lane
Дата:
Сообщение: Re: NOTICE: Vacuum: can not process indices, views and certain system tables