Apache Hive : HPL/SQL - NVL Function

Last updated: August 12, 2026

Apache Hive : HPL/SQL - NVL Function

NVL function returns first non-NULL expression.

Syntax:

NVL(expr1, expr2 [, expr3, ...]); 

Parameters:

ParameterTypeValue
exprNAnyVariable or expression

Notes:

  • When first non-NULL expression is found the following expressions are not evaluated
  • NVL and COALESCE functions are synonyms

Return Value:

  • First non-NULL expression
  • NULL if all expressions evaluate to NULL

Return Type:

The data type of first non-NULL expression.

Example 1:

NVL(NULL, 1); 

Result: 1

Compatibility: Oracle, IBM DB2 and Netezza.

See also: