nvl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

nvl [2015/09/23 20:27] (current)
Line 1: Line 1:
 +====== NVL Function - PL/HQL Reference======
  
 +NVL function returns first non-NULL expression.
 +
 +**Syntax**:
 +
 +<code language="​sql">​
 +NVL(expr1, expr2 [, expr3, ...]); ​
 +</​code>​
 +
 +**Parameters:​**
 +
 +| **Parameter** | **Type** | **Value** |
 +| exprN | Any | Variable or expression |
 +
 +**Notes**:
 +
 +  * When first non-NULL expression is found the following expressions are not evaluated
 +  * NVL and [[coalesce|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:**
 +
 +<code language="​sql">​
 +NVL(NULL, 1); 
 +</​code> ​
 +
 +Result: 1
 +
 +**Compatibility**:​ Oracle, IBM DB2 and Netezza.
 +
 +**Version**:​ PL/HQL 0.01
 +
 +See also:
 +  * [[coalesce|COALESCE]]