# 날짜계산 /* 어제 */ 날짜칼럼 BETWEEN TRUNC(SYSDATE-1) AND TRUNC(SYSDATE-1)+0.99999421 /* 오늘 */ 날짜칼럼 BETWEEN TRUNC(SYSDATE) AND TRUNC(SYSDATE) + 0.99999421 /* 내일 */ 날짜칼럼 BETWEEN TRUNC(SYSDATE+1) AND TRUNC(SYSDATE+1)+0.99999421 /* 금주 */ 날짜칼럼 BETWEEN TRUNC(SYSDATE+1)-TO_CHAR(SYSDATE,’D’) AND TRUNC(SYSDATE+1)-TO_CHAR(SYSDATE,’D’)+6.99999421 /* 차주 */ 날짜칼럼 BETWEEN TRUNC(SYSDATE+8)-TO_CHAR(SYSDATE, ’D’) AND TRUNC(TRUNC(SYSDATE)+14.99999421)-TO_CHAR(SYSDATE, ’D’) /* 금월 */ 날짜칼럼 BETWEEN TRUNC(SYSDATE+1)-TO_CHAR(SYSDATE,’DD’) AND TRUNC(LAST_DAY(SYSDATE))+0.99999421 /* 전월 */ 날짜칼럼 BETWEEN TRUNC(ADD_MONTHS(SYSDATE,-1)+1)-TO_CHAR(SYSDATE,’DD’) AND TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE, -1)))+0.99999421 /* 차월 */ 날짜칼럼 BETWEEN ADD_MONTHS(TRUNC(SYSDATE),1)-TO_CHAR(SYSDATE,’DD’)+1 AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE),1)+0.99999421) # 특정일 까지의 간격을 년, 개월, 일로 표현하기 SELECT TRUNC(MONTHS_BETWEEN(SYSDATE, TO_DATE(’19970101’, ’YYYYMMDD’))/12) "년", TRUNC(MONTHS_BETWEEN(SYSDATE, TO_DATE(’19970101’, ’YYYYMMDD’)) - TRUNC(MONTHS_BETWEEN(SYSDATE, TO_DATE(’19970101’, ’YYYYMMDD’))/12) * 12) "개월", TRUNC((MONTHS_BETWEEN(SYSDATE,TO_DATE(’19970101’, ’YYYYMMDD’)) - TRUNC(MONTHS_BETWEEN(SYSDATE, TO_DATE(’19970101’, ’YYYYMMDD’)))) * 30.5) "일" FROM DUAL;