DEV Community

AntDB
AntDB

Posted on

AntDB-Oracle Compatibility Developer’s Manual P3–71

NVL2

The NVL2 function returns a different value depending on whether the expression is null or not. If expr1 is not null, the value of expr2 is returned, and if expr1 is null, the value of expr3 is returned. If expr2 and expr3 are of different types, expr3 will be converted to expr1's type.

NVL2(expr1, expr2, expr3)

Example:

select math, NVL2(math, 'not null','is null') from test;
 MATH | NVL2(MATH, 'NOT NULL','IS NULL')  
------+-----------------------------------
   88 | not null
      | is null
      | is null
      | is null
(4 rows)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)