Oracle PL/SQL Language Pocket Reference- P15: This pocket guide features quick-reference information to help you use Oracle's PL/SQL language. It includes coverage of PL/SQL features in the newest version of Oracle, Oracle8i. It is a companion to Steven Feuerstein and Bill Pribyl's bestselling Oracle PL/SQL Programming. Updated for Oracle8, that large volume (nearly 1,000 pages) fills a huge gap in the Oracle market, providing developers with a single, comprehensive guide to building applications with PL/SQL and building them the right way. . | specification is FUNCTION LAST_DAY date_in IN DATE RETURN DATE This function is useful because the number of days in a month varies throughout the year. With LAST_DAY for example you do not have to try to figure out if February of this or that year has 28 or 29 days. Just let LAST_DAY figure it out for you. Here are some examples of LAST_DAY Go to the last day in the month LAST_DAY 12-JAN-99 31-JAN-1999 If already on the last day just stay on that day LAST_DAY 31-JAN-99 31-JAN-1999 Get the last day of the month three months after being hired LAST_DAY ADD_MONTHS hiredate 3 Tell me the number of days until the end of the month LAST_DAY SYSDATE - SYSDATE The MONTHS_BETWEEN function The MONTHS_BETWEEN function calculates the number of months between two dates and returns that difference as a number. The specification is FUNCTION MONTHS_BETWEEN date1 IN DATE date2 IN DATE RETURN NUMBER The following rules apply to MONTHS_BETWEEN If datel comes after date2 then MONTHS_BETWEEN returns a positive number. If datel comes before date2 then MONTHS_BETWEEN returns a negative number. If datel and date2 are in the same month then MONTHS_BETWEEN returns a fraction a value between -1 and 1 . If datel and date2 both fall on the last day of their respective months then MONTHS_BETWEEN returns a whole number no fractional component . If datel and date2 are in different months and at least one of the dates is not a last day in the month MONTHS_BETWEEN returns a fractional number. The fractional component is Please purchase PDF Split-Merge on to remove this watermark. calculated on a 31-day month basis and also takes into account any differences in the time component of datel and date2. Here are some examples of the uses of MONTHS_BETWEEN Calculate two ends of month the first earlier than the second MONTHS_BETWEEN 31-JAN-1994 28-FEB-1994 -1 Calculate two ends of month the first later than the second MONTHS_BETWEEN 31-MAR-1995 28-FEB-1994 13 Calculate when both .