Oracle中與時間有關的計算
[sql]
# sysdate+
# sysdate+
# sysdate+
#
SQL> alter session set nls_date_format=
Session altered
SQL> select sysdate
SYSDATE SYSDATE+
SQL>
SQL> select trunc(sysdate
TRUNC(SYSDATE
SQL>
SQL> select trunc(sysdate
TRUNC(SYSDATE
SQL>
SQL> select trunc(next_day(sysdate
TRUNC(NEXT_DAY(SYSD TRUNC(NEXT_DAY(SYSD
SQL>
SQL>
SQL> select trunc(add_months(sysdate
TRUNC(ADD_MONTHS(SY
SQL> select to_date(to_char(add_months(sysdate
TO_DATE(TO_CHAR(ADD
SQL>
SQL> select trunc(sysdate
TRUNC(SYSDATE
SQL> select to_date(to_char(sysdate
TO_DATE(TO_CHAR(SYS
SQL>
SQL> select trunc(last_day(sysdate)) +
TRUNC(LAST_DAY(SYSD
SQL> select add_months(trunc(sysdate
ADD_MONTHS(TRUNC(SY
SQL>
SQL>
SQL> select trunc(sysdate
TRUNC(SYSDATE
SQL>
SQL> select add_months(trunc(sysdate
ADD_MONTHS(TRUNC(SY
SQL>
SQL>
SQL> select trunc(trunc(sysdate
TRUNC(TRUNC(SYSDATE
SQL>
SQL> select trunc(sysdate
TRUNC(SYSDATE
SQL> select to_date(to_char(sysdate
TO_DATE(TO_CHAR(SYS
SQL>
SQL> select trunc(add_months(sysdate
TRUNC(ADD_MONTHS(SY
SQL> select to_date(to_char(sysdate
TO_DATE(TO_CHAR(SYS
SQL>
SQL>
SQL> select round(to_number(to_date(
VALUE
SQL>
SQL> select round(to_number(to_date(
VALUE
SQL>
SQL> select round(to_number(to_date(
VALUE
SQL>
From:http://tw.wingwit.com/Article/program/Oracle/201311/18017.html