Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
Applies to:
Databricks SQL
Databricks Runtime
Returns expr2 if expr1 is not NULL, or expr3 otherwise. This function is a synonym for CASE WHEN expr1 IS NOT NULL expr2 ELSE expr3 END.
Syntax
nvl2(expr1, expr2, expr3)
Arguments
expr1: An expression of any type.expr2: An expression of any type.expr3: An expression that shares a least common type withexpr2.
Returns
The result is least common type of expr2 and expr3.
Special considerations apply to VARIANT types. See isnull function for details.
Examples
> SELECT nvl2(NULL, 2, 1);
1
> SELECT nvl2('spark', 2, 1);
2