Progress
Embedded SQL-92
Guide and Reference


Using the NVL Scalar Function

You can use the scalar function NVL to identify NULL values in a column. The syntax of the NVL function is:

SYNTAX
EXEC SQL
  NVL (expression1, expression2 ) ; 

If the first expression value is not NULL, the NVL function returns its value. If the first expression value is NULL, NVL returns the value of the second expression. The following example shows how to use NVL to identify NULL values in the commission column of the employee table:

EXEC SQL
     SELECT sal + NVL (commission, 0) ’Total Salary’
     FROM employee ; 

If the value of the commission column is NULL, the function adds zero to the base salary of the employee and returns the total in a temporary column named Total Salary.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095