개인적인 정리

ORACLE LAST_DAY() 본문

DB/ORACLE

ORACLE LAST_DAY()

yeon.Biju 2020. 4. 6. 14:45

오라클 LAST_DAY()

 

LAST_DAY()

   - 달의 마지막 날짜를 구해준다. 

 

LAST_DAY(date)

의 형태

 

LAST_DAY returns the date of the last day of the month that contains date. The last day of the month is defined by the session parameter NLS_CALENDAR. The return type is always DATE, regardless of the data type of date.

 

 

SQL> SELECT LAST_DAY(SYSDATE) FROM DUAL ;

   --> 2020/04/30 오후 2:42:01

 

SQL> SELECT LAST_DAY('2020-04-01') FROM DUAL;

   --> ORA-01861: literal does not match format string

 

SQL> SELECT LAST_DAY(TO_DATE('2020-04-01', 'YYYY-MM-DD')) FROM DUAL;

   --> 2020/04/30

 

SQL> SELECT TO_CHAR(LAST_DAY(SYSDATE), 'YYYY-MM-DD') FROM DUAL ;

   --> 2020-04-30

'DB > ORACLE' 카테고리의 다른 글

Oracle LISTAGG()  (0) 2020.04.08
Oracle LENGTH()  (0) 2020.04.07
Oracle LEAD()  (0) 2020.04.07
Oracle LAST_VALUE()  (0) 2020.04.06
ORACLE LAST()  (0) 2020.04.06
Oracle INSTR()  (0) 2020.04.06
Oracle INSERTCHILDXML()  (0) 2020.04.06
Oracle INITCAP()  (0) 2020.04.06
Comments