일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 스크립트
- HTML5
- 톰캣
- JSTL
- MYSQL
- null
- json
- 호환성
- checbox
- html
- 문자열
- maven
- jquery
- 이클립스
- switch
- java
- 오라클
- 전자정부 표준프레임워크
- SSL
- 웹 플랫폼 설치 관리자
- 날짜
- Oracle
- 네이버스마트 에디터
- @RequestBody
- exception
- DB
- RADIO
- spring form tag
- 한글
- php
- Today
- Total
개인적인 정리
Oracle LAST_VALUE() 본문
오라클 LAST_VALUE()
LAST_VALUE()
-
LAST_VALUE(expr) OVER (analytic_clause)
LAST_VALUE(expr RESPECT|IGNORE NULL) OVER (analytic_clause)
의 형태
LAST_VALUE is an analytic function that is useful for data densification. It returns the last value in an ordered set of values.
{RESPECT | IGNORE} NULLS determine whether null values of expr are included in or eliminated from the calculation. the default is RESPECT NULLS. If the last value in the set is null, then the function returns NULL unless you specify IGNORE NULLS, then LAST_VALUE returns thea last non-null value in the set, or NULL if all values are null.
You cannot nest analytic functions by using LAST_VALUE or any other analytic function for expr. However, you can use other built-in function expressions for expr.
If you omit the windowing_clause of the analytic_clause, it defaults to RANGE BETWEEN UNBOUNDED PRECDEING AND CURRENT ROW. This default sometimes returns an unexpected value, because the last value in the window is at the bottom of the window, which is not fixed. It keeps changing as the current row changes. For expected results, specify the windowing_clause as RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING. Alternatively, you can specify the windowing_clause as RANGE BETWEEN CURRNET ROW UNBOUNDED FOLLOWING.
SQL >
SELECT
last_name,
salary,
hire_date,
LAST_VALUE(hire_date) OVER(ORDER BY salary ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS lv
FROM (SELECT * FROM employees where department_id=90 order by hire_date)
'DB > ORACLE' 카테고리의 다른 글
Oracle LN() (0) | 2020.04.08 |
---|---|
Oracle LISTAGG() (0) | 2020.04.08 |
Oracle LENGTH() (0) | 2020.04.07 |
Oracle LEAD() (0) | 2020.04.07 |
ORACLE LAST_DAY() (0) | 2020.04.06 |
ORACLE LAST() (0) | 2020.04.06 |
Oracle INSTR() (0) | 2020.04.06 |
Oracle INSERTCHILDXML() (0) | 2020.04.06 |