NVL Function

NVL(expr1, expr2) : In SQL, NVL() converts a null value to an actual value. Data types that can be used are date, character, and number. The data type must match with each other i.e. expr1 and expr2 must be of the same data type. 

Syntax – NVL (expr1, expr2) 

expr1 is the source value or expression that may contain a null. 
expr2 is the target value for converting the null. 

Example – 

SELECT  salary, NVL(commission_pct, 0), 
    (salary*12) + (salary*12*NVL(commission_pct, 0)) 
      annual_salary FROM employees; 

Leave a comment

Your email address will not be published. Required fields are marked *