[Oracle] NUMTOYMINTERVAL()
오라클 NUMTOYMINTERVAL()
NUMTOYMINTERVAL()
-
NUMTOYMINTERVAL(n, interval_unit)
의 형태
NUMTOYMINTERVAL converts number n to an INTERVAL YEAR TO MONTH literal. The argument n can be any NUMBER value or an expression that can be implicitly convrted 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 resolove to one of the following string values:
- 'YEAR'
- 'MONTH'
interval_unit is case insensitive. Leading and trailing values within the parentheses are ignored. By default, the precision of the return is 9.
오라클 oe 계정으로 테스트 가능
SQL>SELECT
last_name,
hire_date,
salary,
SUM(salary) OVER (ORDER BY hire_date RANGE NUMTOYMINTERVAL(1, 'YEAR') PRECEDING) AS t_sal
FROM employees
ORDER BY last_name, hire_date ;