Omnidex SQL Function: $IFNULL

Description

The $IFNULL function tests to see if the first expression produces a NULL, and if so, returns the second expression.

This function returns the same datatype as the passed parameter. If all passed parameters are NULL, then this function returns a NULL.

Syntax

$IFNULL ( expression_1, expression_2 )
expression_1 and expression_2

Required. An expression using SQL language that produces a value. A scalar expression is generally equivalent to a select item in the SQL SELECT statement, and can be a character expression, numeric expression or date expression.

Example

Example 1: $IFNULL against columns

> select $ifnull(name, 'Name not given') identifier from individuals;

IDENTIFIER
--------------------------------------------------
MS. MARY LEWIS
MRS. ALICE R TOLLIVER
MR. SIDNEY K TOLLIVER
MRS. JENNIFER J HOPKINS
MR. CHARLIE HOPKINS
MS. KIMBERLY BLUE
KATHLEEN TUCKER

Additional Resources

See also:

 
Back to top
dev/sql/functions/ifnull.txt ยท Last modified: 2016/06/28 22:38 (external edit)