1
1
<!--
2
- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.295 2005/11/19 19:44:54 tgl Exp $
2
+ $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.296 2005/11/28 23:18:48 momjian Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -7227,16 +7227,23 @@ SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END;
7227
7227
<primary>COALESCE</primary>
7228
7228
</indexterm>
7229
7229
7230
+ <indexterm>
7231
+ <primary>NVL</primary>
7232
+ </indexterm>
7233
+
7234
+ <indexterm>
7235
+ <primary>IFNULL</primary>
7236
+ </indexterm>
7237
+
7230
7238
<synopsis>
7231
7239
<function>COALESCE</function>(<replaceable>value</replaceable> <optional>, ...</optional>)
7232
7240
</synopsis>
7233
7241
7234
7242
<para>
7235
7243
The <function>COALESCE</function> function returns the first of its
7236
7244
arguments that is not null. Null is returned only if all arguments
7237
- are null. This is often useful to substitute a
7238
- default value for null values when data is retrieved for display,
7239
- for example:
7245
+ are null. It is often used to substitute a default value for
7246
+ null values when data is retrieved for display, for example:
7240
7247
<programlisting>
7241
7248
SELECT COALESCE(description, short_description, '(none)') ...
7242
7249
</programlisting>
@@ -7246,7 +7253,9 @@ SELECT COALESCE(description, short_description, '(none)') ...
7246
7253
Like a <token>CASE</token> expression, <function>COALESCE</function> will
7247
7254
not evaluate arguments that are not needed to determine the result;
7248
7255
that is, arguments to the right of the first non-null argument are
7249
- not evaluated.
7256
+ not evaluated. This SQL-standard function provides capabilities similar
7257
+ to <function>NVL</> and <function>IFNULL</>, which are used in some other
7258
+ database systems.
7250
7259
</para>
7251
7260
</sect2>
7252
7261
@@ -7262,16 +7271,19 @@ SELECT COALESCE(description, short_description, '(none)') ...
7262
7271
</synopsis>
7263
7272
7264
7273
<para>
7265
- The <function>NULLIF</function> function returns a null value if and only
7266
- if <replaceable>value1</replaceable> and
7267
- <replaceable>value2</replaceable> are equal. Otherwise it returns
7268
- <replaceable>value1</replaceable>. This can be used to perform the
7269
- inverse operation of the <function>COALESCE</function> example
7270
- given above:
7274
+ The <function>NULLIF</function> function returns a null value if
7275
+ <replaceable>value1</replaceable> and <replaceable>value2</replaceable>
7276
+ are equal; otherwise it returns <replaceable>value1</replaceable>.
7277
+ This can be used to perform the inverse operation of the
7278
+ <function>COALESCE</function> example given above:
7271
7279
<programlisting>
7272
7280
SELECT NULLIF(value, '(none)') ...
7273
7281
</programlisting>
7274
7282
</para>
7283
+ <para>
7284
+ If <replaceable>value1</replaceable> is <literal>(none)</>, return a null,
7285
+ otherwise return <replaceable>value1</replaceable>.
7286
+ </para>
7275
7287
7276
7288
</sect2>
7277
7289
0 commit comments