Table of Contents

Search

  1. About the Data Vault SQL Reference
  2. Introduction to SQL Reference for Informatica Data Vault
  3. Date and Time Arithmetic
  4. WHERE Clauses
  5. UNION Operator
  6. Parameterized Query
  7. Functions

Data Vault SQL Reference

Data Vault SQL Reference

IFNULL

IFNULL

Returns the first of two arguments that is not null. This is the same as calling the COALESCE function with only two arguments. As with the COALESCE function, the IFNULL arguments are evaluated in the order in which they are specified, and the result is null only if both arguments are null.

IFNULL Example

SELECT item, IFNULL(price, -1) AS Price FROM inventory;
In this example, a SELECT statement returns a list each item and its associated price from the
inventory
table. The IFNULL function is used here to intercept item prices that have not been set (and are therefore null) and return a value of
-1
instead. For items whose price is not null, the IFNULL function returns the price value unchanged.
The equivalent (searched) CASE expression for this example would be the following:
SELECT item, CASE WHEN price IS NOT NULL THEN price ELSE -1 END AS Price FROM inventory;

0 COMMENTS

We’d like to hear from you!