From: Josh Berkus <josh@agliodbs.com>
To: Kevin Barrett <anon000000@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: syntax for using function parameter in to_char
Date: Fri, 01 Feb 2002 12:40:25 -0800
Message-ID: <web-682424@davinci.ethosmedia.com> (raw)
In-Reply-To: <a3ektg$1ofq$1@news.tht.net>
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 AS VARCHAR) || ''seconds'')::interval,
''dd/mm/yyyy hh:mi'') as RESULT
'
LANGUAGE 'sql';
Got it? Check, though, a "CAST (bigint as varchar)" may or may not
work.
-Josh
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, anon000000@hotmail.com
Subject: Re: syntax for using function parameter in to_char
In-Reply-To: <web-682424@davinci.ethosmedia.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox