[Oracle] Interval

DB/Oracle 2016. 7. 22. 11:21
donaricano-btn

 Interval 

- Intervals provide a way of storing a specific period of time that separates two datetime value.

-There are currently two supported types interval, one specifying intervals in years and months, the other specifying intervals in days, hours, minutes and second

Example

1. + 1 year

SYSDATE + (INTERVAL '1' YEAR) 

2. + 1 month

SYSDATE + (INTERVAL '1' MONTH)

3. + 1 day
      SYSDATE + (INTERVAL '1' DAY)

4. + 1  hour
      SYSDATE + (INTERVAL '1' HOUR)

5. + 1 minute

SYSDATE + (INTERVAL '1' MINUTE)

6. +1 second

SYSDATE + (INTERVAL '1' SECOND)

7. + 2hours and 10 min
    SYSDATE + (INTERVAL '02:10' HOUR TO MINUTE)

8. + 1min and 30 sec
    SYSDATE + (INTERVAL '01:30' MINUTE TO SECOND) 


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

[Oracle] To get day of week  (0) 2016.07.01
[Oracle] How to get a weekend  (0) 2016.06.07
[Oracle] START WITH, CONNTECT BY  (0) 2016.04.15
[Oracle] ORA-01427  (0) 2016.04.05
[Oracle] - LAST_DAY()  (0) 2016.04.05
블로그 이미지

리딩리드

,