From: | Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com> |
---|---|
To: | Jomon Skariah <jomons(at)aztec(dot)soft(dot)net> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Porting from Oracl to Postgres |
Date: | 2003-09-05 14:29:56 |
Message-ID: | 20030905142956.89456.qmail@web20808.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
--- Rod Taylor <rbt(at)rbt(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | floyds | 2003-09-05 17:41:26 | recursive sql |
Previous Message | Richard Huxton | 2003-09-05 14:12:04 | Re: Porting from Oracl to Postgres |