Re: Oracle-Style Date Functions - Mailing list pgsql-novice

From Josh Berkus
Subject Re: Oracle-Style Date Functions
Date
Msg-id 200312051115.35047.josh@agliodbs.com
Whole thread Raw
In response to Oracle-Style Date Functions  (David Rickard <David.Rickard@GTScompanies.com>)
List pgsql-novice
David,

> Has anyone developed PostgreSQL versions of the Oracle date functions?  I'm
> especially interested in ports of ADD_MONTHS and NEXT_DAY, or hints on
> replicating them in PostgreSQL.

Trivial:

CREATE FUNCTION add_months (timestamp, integer)
RETURNS timestamp AS '
SELECT $1 + (''1 month''::INTERVAL * $2);
' LANGUAGE SQL IMMUTABLE, STRICT;

CREATE FUNCTION NEXT_DAY (timestamp)
RETURNS timestamp AS '
SELCET $1 + ''1 day''::INTERVAL;
' LANGUAGE SQL IMMUTABLE, STRICT;

--
Josh Berkus
Aglio Database Solutions
San Francisco

pgsql-novice by date:

Previous
From: Sai Hertz And Control Systems
Date:
Subject: Re: Managing users
Next
From: "David Benoff"
Date:
Subject: PostgreSQL and ADO.net?