nvl2

Differences

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

Link to this comparison view

nvl2 [2015/09/23 20:27] (current)
Line 1: Line 1:
 +====== NVL2 Function - PL/HQL Reference======
  
 +If the first expression is NOT NULL, NVL2 function returns the result of the second expression, otherwise it returns the result of the third expression.
 +
 +**Syntax**:
 +
 +<code language="​sql">​
 +NVL2(expr1, expr2, expr3); ​
 +</​code>​
 +
 +**Parameters:​**
 +
 +| **Parameter** | **Type** | **Value** | 
 +| exprN | Any | Variable or expression | 
 +
 +**Notes**:
 +
 +  * If expr1 is not NULL, expr2 is only evaluated; and if expr1 is NULL, expr3 is only evaluated
 +
 +**Return Type:**
 +
 +The data type of the returned expression by expr2 or expr3 depending whether expr1 is NULL or not.
 +
 +**Example 1:**
 +
 +<code language="​sql">​
 +NVL2(NULL, 1, 2); 
 +</​code> ​
 +
 +Result: 2
 +
 +**Compatibility**:​ Oracle and IBM DB2.
 +
 +**Version**:​ PL/HQL 0.01