--- 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