Oracle9i SQL Reference Release 1 (9.0.1) Part Number A90125-01 |
|
Functions, 56 of 166
last_day::=
last_day
LAST_DAY
returns the date of the last day of the month that contains date.
The following statement determines how many days are left in the current month.
SELECT SYSDATE, LAST_DAY(SYSDATE) "Last", LAST_DAY(SYSDATE) - SYSDATE "Days Left" FROM DUAL; SYSDATE Last Days Left --------- --------- ---------- 23-OCT-97 31-OCT-97 8
The following example adds 5 months to the hiredate of each employee to give an evaluation date:
SELECT last_name, hire_date, TO_CHAR( ADD_MONTHS(LAST_DAY(hire_date), 5)) "Eval Date" FROM employees; LAST_NAME HIRE_DATE Eval Date ------------------------- --------- --------- King 17-JUN-87 30-NOV-87 Kochhar 21-SEP-89 28-FEB-90 De Haan 13-JAN-93 30-JUN-93 Hunold 03-JAN-90 30-JUN-90 Ernst 21-MAY-91 31-OCT-91 Austin 25-JUN-97 30-NOV-97 Pataballa 05-FEB-98 31-JUL-98 Lorentz 07-FEB-99 31-JUL-99 . . .
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|