Few databases support intervals.

We have discussed adding interval support to JDBC and it will probably happen via JSR 310.

On May 4, 2011, at 3:01 PM, Knut Anders Hatlen wrote:

dag.wanvik@oracle.com (Dag H. Wanvik) writes:

Rick Hillegas <rick.hillegas@oracle.com> writes:

I don't see an existing JIRA for this issue. Feel free to log one.

Rick, do you know if there is a standard way of doing this (beyond the
JDBC escape function)? I didn't find anything in the standard. It could
be that this is one of those things that are not standardized and the
presence of the JDBC escape is there to cover for vendors differing
implementations of this. If so, we would be hestitant to add this unless
most major vendors agreed on this syntax.

Hi Dag,

SQL:2003, part 2, has a section 4.6.4 Operations involving datetimes and
intervals. If my understanding is correct, databases that support
intervals would allow you to write things like:

 VALUES TIMESTAMP('2010-12-31 23:59:59') + INTERVAL '1' DAY

Knut Anders

Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803