O'Reilly logo

Netezza SQL by Mike Larkins, Tom Coffing

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12 – Interrogating the Data

"I don't know who my grandfather was. I am more interested in who his grandson will become."

Abraham Lincoln

NVL Syntax

Compatibility: NPS Extension

The NPS database software provides a function to substitute a NULL value in a column for another value. Earlier in this book we saw IS NULL and IS NOT NULL used within the WHERE clause. An additional way to test is to use the NVL function.

The purpose of this function is to compare the data value in the first column and when it contains a NULL, transform it for the life of the SQL statement to the second value.

The syntax for the NVL follows:

SELECTNVL(<column-name>, <column-or-literal-value> )

,<Aggregate>  ( NVL(<column-name>, <column-or-literal-value>  ))

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required