일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- MYSQL
- checbox
- json
- DB
- switch
- html
- null
- 이클립스
- exception
- HTML5
- 호환성
- spring form tag
- 한글
- 오라클
- 웹 플랫폼 설치 관리자
- 문자열
- Oracle
- 스크립트
- 날짜
- jquery
- 톰캣
- maven
- @RequestBody
- JSTL
- php
- SSL
- RADIO
- 네이버스마트 에디터
- java
- 전자정부 표준프레임워크
- Today
- Total
개인적인 정리
ORACLE DECODE() 본문
오라클 DECODE()
DECODE(expr, search, result, default)
DECODE(expr, search, result,
search, result,
search, result,
default);
와 같은 형태도 가능하여 여러개를 한번에 비교할 수 있다.
DECODE compares expr to each search value one by one. If expr is equals to a search, then Oracle Database returns the corresponding result. If no match is found, then Oracle returns default. If default is omitted, then Oracle returns null.
The arguments can be any of the numeric type(NUMBER, BINARY_FLOAT, or BINARY_DOUBLE) or character types.
- If expr and search are character data, then Oracle compares them using nonpadded comparison semantics, expr, search, and result can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2. The string returned is of VARCHAR2 data type and is in the same character set as the first result parameter.
- If the first search-result pair numeric, the Oracle compares all search-result expressions and the first expr to determine the argument with the highest numeric precedence, implicitly converts the remaining arguments to that data type, and returns that data type.
Oracle automatically converts expr and each search value to the data type of the first search value before comparing. Oracle automatically converts the return value to the same data type as the first result. If the first result has the data type CHAR or if the first result is null, then Oracle converts the return value to the data type VARCHAR2.
In a DECODE function, Oracle considers two nulls to be equivalent. If expr is null, then Oracle returns the result of the first search that is also null.
The maximum number of components in the DECODE function including expr, searches, results, and default is 255.
SQL > SELECT DECODE ('88',
'B', 'FFF',
'C', 'FFF',
'D', 'FFF',
'a', 'TTT',
'디폴트'
) FROM DUAL ;
--> 디폴트
SQL > SELECT DECODE ('a',
'B', 'FFF',
'C', 'FFF',
'D', 'FFF',
'a', 'TTT',
'디폴트'
) FROM DUAL ;
--> TTT
'DB > ORACLE' 카테고리의 다른 글
ORACLE EXP() (0) | 2020.03.30 |
---|---|
ORACLE EMPTY_BLOB(), EMPTY_CLOB() (0) | 2020.03.30 |
ORACLE DENSE_RANK() (0) | 2020.03.26 |
ORACLE DELETEXML() (0) | 2020.03.26 |
ORACLE CURRENT_TIMESTAMP() (0) | 2020.03.26 |
ORACLE CURRENT_DATE() (0) | 2020.03.26 |
ORACLE COUNT() (0) | 2020.03.26 |
ORACLE COS() (0) | 2020.03.26 |