Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: months_between

Re: months_between

From: Jan Schaefer <jan.schaefer_at_kksl.uni-leipzig.de>
Date: Fri, 01 Aug 2003 11:47:36 +0200
Message-ID: <bgdcvr$9qu$1@news.uni-leipzig.de>


chivas schrieb:
> I run this query:
>
> select months_between('15-MAR-83','15-MAR-97') from dual
>
> an I get -168 as the answer.
>
> Can someone explain this?

 From the SQL docs:

MONTHS_BETWEEN returns number of months between dates d1 and d2. If d1 is later than d2, result is positive; if earlier, negative. If d1 and d2 are either the same days of the month or both last days of months, the result is always an integer. Otherwise Oracle calculates the fractional portion of the result based on a 31-day month and considers the difference in time components of d1 and d2.

So long,

Jan Received on Fri Aug 01 2003 - 04:47:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US