Skip to content

NANVL

  • number value: This parameter specifies the input number that is to be checked. It could be a variable, a numeric literal, or the result of another function or operation.
  • value if nan: This is a fallback value that NaNVL will return if the first parameter is not a number (NaN). This ensures that NaNVL always returns a valid number.
SELECT NANVL(1.7, 3.2) as value_1, NANVL(NAN(), 4.7) as value_2 FROM dual;
| VALUE_1 | VALUE_2 |
|---------|---------|
| 1.7 | 4.7 |

In the Example, the Oracle function NANVL is used to replace a NaN value, if present, with a specific number. NANVL(1.7, 3.2) returned 1.7 because 1.7 is not NaN. NANVL(NAN(), 4.7) returned 4.7 because NaN was replaced with 4.7.