개인적인 정리

[Oracle]NUMTODSINTERVAL() 본문

DB/ORACLE

[Oracle]NUMTODSINTERVAL()

yeon.Biju 2020. 4. 13. 13:41

오라클 NUMTODSINTERVAL()

 

NUMTODSINTERVAL()

   -

 

NUMTODSINTERVAL(n, interval_unit)

의 형태

 

NUMTODSINTERVAL converts n to an INTERVAL DAY TO SECOND literal. The argument n can be any NUMBER value or an expression that can be implicitly converts to a NUMBER value. The argument interval_unit can be of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type. The value for interval_unit specified the unit of n and must resolve to one of the following string values :

  • 'DAY'
  • 'HOUR'
  • MINUTE'
  • 'SECOND'

interval_unit is case insensitive. Leading and trailing values within the parentheses are ignored. By default, the precision of the return is 9.

 

SQL>SELECT NUMTODSINTERVAL(100, 'day') FROM DUAL ;

--> +100 00:00:00.000000

 

 

오라클 OE 계정으로 테스트 가능.

SQL>

SELECT 
    manager_id,
    last_name,
    hire_date,
    COUNT(*) OVER (PARTITION BY manager_id ORDER BY hire_date RANGE NUMTODSINTERVAL(100, 'day') PRECEDING) AS t_count
FROM employees
ORDER BY last_name, hire_date ;    

 

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

[Oracle] PERCENT_RANK()  (0) 2020.04.14
[Oracle]NVL2()  (0) 2020.04.13
[Oracle] NVL()  (0) 2020.04.13
[Oracle] NUMTOYMINTERVAL()  (0) 2020.04.13
[Oralce] NULLIF()  (0) 2020.04.13
[Oracle] NTILE()  (0) 2020.04.13
[Oracle] NTH_VALUE()  (0) 2020.04.10
[Oracle] NEXT_DAY()  (0) 2020.04.10
Comments