Re: Porting from Oracl to Postgres - Mailing list pgsql-sql

From Jeff Eckermann
Subject Re: Porting from Oracl to Postgres
Date
Msg-id 20030905142956.89456.qmail@web20808.mail.yahoo.com
Whole thread Raw
In response to Re: Porting from Oracl to Postgres  (Rod Taylor <rbt@rbt.ca>)
List pgsql-sql
--- 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


pgsql-sql by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Porting from Oracl to Postgres
Next
From:
Date:
Subject: recursive sql