개인적인 정리

[Oracle] NVL() 본문

DB/ORACLE

[Oracle] NVL()

yeon.Biju 2020. 4. 13. 14:10

오라클 NVL()

 

NVL()

   -

 

NVL(expr1, expr2)

의 형태

 

NVL lets you replace null(returned as a blank) with a string in the results of a query. If expr1 is null, the NVL returns expr2. If expr1 is not null, then NVL returns expr1

 

The argument expr1 and expr2 can have day data type. If their data types are different, then Oracle Database implictily converts one to the other. If they cannot be converted implicitly, then the database returns an error. The implicit conversion is implemented as follows :

 

  • If expr1 is character data, then Oracle Database converts expr2 to the data type of expr1 before comparing them and returns VARCHAR2 in the character set of exp1.
  • If expr1 is numeric, then Oracle Database determines which argument has the highest mumeric precedence, implicitly converts the other argument to that data type, and returns theat data type.

SQL> SELECT NVL(2,1), NVL(NULL, 1), NVL('TEST', '--'), NVL('', '--') FROM DUAL ;

   -->  2       1          TEST           --

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

[Oracle] RANK()  (0) 2020.04.14
[Oracle] POWER()  (0) 2020.04.14
[Oracle] PERCENT_RANK()  (0) 2020.04.14
[Oracle]NVL2()  (0) 2020.04.13
[Oracle] NUMTOYMINTERVAL()  (0) 2020.04.13
[Oracle]NUMTODSINTERVAL()  (0) 2020.04.13
[Oralce] NULLIF()  (0) 2020.04.13
[Oracle] NTILE()  (0) 2020.04.13
Comments