NVL Function Example | Teradata Vantage - 17.10 - Example - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1145-171K
Language
English (United States)

The following query:

SELECT department_name, 
   NVL(last_name,'NO EMPLOYEE') "LAST NAME"
FROM employee E 
   FULL OUTER JOIN Department D
ON department_number=d.department_number;
WHERE department_number IN(402,600);

returns:

Department_name      LAST NAME
--------- --------------------
Software Support     Crane
New Department       NO EMPLOYEE

In this example, the NVL function returned the result as last_name column value from the employee table and for the cases where the last_name value is NULL, the function returned the result as NO EMPLOYEE.