This is an old revision of the document!


DRAFT

Omnidex SQL Function: $IFNULL

Description

$IFNULL specifies a return value for columns that contain null values. The column data type and the return value data type must match.

If column-value is NULL then return specified-value, else return column-value

Use of this function could change the results of a calculated average. A true NULL is generally not included in a count and thus not included in an average. A NULL altered with this function will be included in the count and the average.

Syntax

$IFNULL(column_spec, specified-value)

column_spec

Required. Column name that might contain a null value.

specified-value

Required. The value to return if the column value is null. This value must be of the same data type as the column.

Example

Example 1

SELECT company,
$IFNULL(contact, 'No contact')
FROM customers 
WHERE state = 'ca'
 
Back to top
dev/sql/functions/ifnull.1260199528.txt.gz ยท Last modified: 2016/06/28 22:38 (external edit)