Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: months_between
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
![]() |
![]() |