NANVL
NANVL(number value, value if NaN)
Section titled “NANVL(number value, value if NaN)”- 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.
Example
Section titled “Example”SELECT NANVL(1.7, 3.2) as value_1, NANVL(NAN(), 4.7) as value_2 FROM dual;Output
Section titled “Output”| VALUE_1 | VALUE_2 ||---------|---------|| 1.7 | 4.7 |Explanation
Section titled “Explanation”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.