This function returns the number of months between date1 and date2. If both
date1 and date2 have the same day component, or if both are the last days of
their respective months, then the result is an integer. Otherwise, the
result will contain a fractional portion of a 31-day month.
REF: Page 160 in Oracle PL_SQL Programming by Scott Urman
Ram Srinivasan
PRA International, Inc.
4105 Lewis & Clark Drive
Charlottesville, VA 22911-5801
Tel: (434) 951-3365
Web: www.praintl.com
-----Original Message-----
From: Johnson, Cameron [mailto:cameron.[Email Address Removed] Thursday, February 28, 2002 3:07 PM
To: LazyDBA.com Discussion
Subject: Function Months_Between
Does anyone know how the function months_between is calculated? We are
getting invalid results when we use 28_FEB as the end of month.
See example below:
1 select FLOOR(MONTHS_BETWEEN('31-JAN-2002', '30-may-2001')) MonthsA
2 ,FLOOR(MONTHS_BETWEEN('28-FEB-2002', '30-may-2001')) MonthsB
3 ,FLOOR(MONTHS_BETWEEN('31-MAR-2002', '30-may-2001')) MonthsC
4* from dual
SQL> /
MONTHSA MONTHSB MONTHSC
---------- ---------- ----------
8 8 10
MONTHSB should be 9.
Cameron Johnson
Information Technology Services
University Of Rochester
Rochester, New York 14620
585-273-2014
fax 585-273-1012
cell 585-451-2831
email: cameron.[Email Address Removed] to comment on our service?
http://www.uis.rochester.edu/syspub/doc/SurveyOnCall.htm Thanks.
--------
Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to oracledba-[Email Address Removed] subscribe: send a blank email to oracledba-[Email Address Removed] the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page