From: Jeff Eckermann <jeff_eckermann@yahoo.com>
To: Jomon Skariah <jomons@aztec.soft.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Porting from Oracl to Postgres
Date: Fri, 5 Sep 2003 07:29:56 -0700 (PDT)
Message-ID: <20030905142956.89456.qmail@web20808.mail.yahoo.com> (raw)
In-Reply-To: <1062770250.66151.9.camel@jester>
--- Rod Taylor <rbt@rbt.ca> wrote:
> On Fri, 2003-09-05 at 00:24, Jomon Skariah wrote:
> >
> > Hi,
> >
> > Thanks for your replys.
> >
> > We are facing another problem now.
> >
> > we need to find an alternative for Oracle's
> ADD_MONTHS in PostGres..
>
> Guessing based on the name that it adds a quantity
> of months to a
> timestamp. How about an SQL Interval?
>
> now() + interval '15 months'
>
> List of functions:
>
http://www.postgresql.org/docs/7.3/interactive/functions.html
For compatibility in your application, you could do
something like:
CREATE FUNCTION add_months(date, integer) RETURNS date
AS '
SELECT ($1 + ( $2::text || ''
months'')::interval)::date;
' LANGUAGE 'sql';
I second the recommendation to spend some time looking
over the available functions in PostgreSQL.
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
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: jeff_eckermann@yahoo.com, jomons@aztec.soft.net
Subject: Re: Porting from Oracl to Postgres
In-Reply-To: <20030905142956.89456.qmail@web20808.mail.yahoo.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