+
+
+
+
+
+
COALESCE(value , ...)
The COALESCE function returns the first of its
arguments that is not null. Null is returned only if all arguments
- are null. This is often useful to substitute a
- default value for null values when data is retrieved for display,
- for example:
+ are null. It is often used to substitute a default value for
+ null values when data is retrieved for display, for example:
SELECT COALESCE(description, short_description, '(none)') ...
Like a CASE expression, COALESCE will
not evaluate arguments that are not needed to determine the result;
that is, arguments to the right of the first non-null argument are
- not evaluated.
+ not evaluated. This SQL-standard function provides capabilities similar
+ to NVL> and IFNULL>, which are used in some other
+ database systems.
- The NULLIF function returns a null value if and only
- if value1 and
- value2 are equal. Otherwise it returns
- value1. This can be used to perform the
- inverse operation of the COALESCE example
- given above:
+ The NULLIF function returns a null value if
+ value1 and value2
+ are equal; otherwise it returns value1.
+ This can be used to perform the inverse operation of the
+ COALESCE example given above:
SELECT NULLIF(value, '(none)') ...
+ If value1 is (none)>, return a null,
+ otherwise return value1.
+