Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ee4aa302
Commit
ee4aa302
authored
Nov 28, 2005
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve documentation for COALESCE and NULLIF. Add references for NVL
and IFNULL. Backpatch to 8.1.X.
parent
20054503
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
doc/src/sgml/func.sgml
doc/src/sgml/func.sgml
+23
-11
No files found.
doc/src/sgml/func.sgml
View file @
ee4aa302
<!--
<!--
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.29
5 2005/11/19 19:44:54 tgl
Exp $
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.29
6 2005/11/28 23:18:48 momjian
Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -7227,6 +7227,14 @@ SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END;
...
@@ -7227,6 +7227,14 @@ SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END;
<primary>COALESCE</primary>
<primary>COALESCE</primary>
</indexterm>
</indexterm>
<indexterm>
<primary>NVL</primary>
</indexterm>
<indexterm>
<primary>IFNULL</primary>
</indexterm>
<synopsis>
<synopsis>
<function>COALESCE</function>(<replaceable>value</replaceable> <optional>, ...</optional>)
<function>COALESCE</function>(<replaceable>value</replaceable> <optional>, ...</optional>)
</synopsis>
</synopsis>
...
@@ -7234,9 +7242,8 @@ SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END;
...
@@ -7234,9 +7242,8 @@ SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END;
<para>
<para>
The <function>COALESCE</function> function returns the first of its
The <function>COALESCE</function> function returns the first of its
arguments that is not null. Null is returned only if all arguments
arguments that is not null. Null is returned only if all arguments
are null. This is often useful to substitute a
are null. It is often used to substitute a default value for
default value for null values when data is retrieved for display,
null values when data is retrieved for display, for example:
for example:
<programlisting>
<programlisting>
SELECT COALESCE(description, short_description, '(none)') ...
SELECT COALESCE(description, short_description, '(none)') ...
</programlisting>
</programlisting>
...
@@ -7246,7 +7253,9 @@ SELECT COALESCE(description, short_description, '(none)') ...
...
@@ -7246,7 +7253,9 @@ SELECT COALESCE(description, short_description, '(none)') ...
Like a <token>CASE</token> expression, <function>COALESCE</function> will
Like a <token>CASE</token> expression, <function>COALESCE</function> will
not evaluate arguments that are not needed to determine the result;
not evaluate arguments that are not needed to determine the result;
that is, arguments to the right of the first non-null argument are
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 <function>NVL</> and <function>IFNULL</>, which are used in some other
database systems.
</para>
</para>
</sect2>
</sect2>
...
@@ -7262,16 +7271,19 @@ SELECT COALESCE(description, short_description, '(none)') ...
...
@@ -7262,16 +7271,19 @@ SELECT COALESCE(description, short_description, '(none)') ...
</synopsis>
</synopsis>
<para>
<para>
The <function>NULLIF</function> function returns a null value if and only
The <function>NULLIF</function> function returns a null value if
if <replaceable>value1</replaceable> and
<replaceable>value1</replaceable> and <replaceable>value2</replaceable>
<replaceable>value2</replaceable> are equal. Otherwise it returns
are equal; otherwise it returns <replaceable>value1</replaceable>.
<replaceable>value1</replaceable>. This can be used to perform the
This can be used to perform the inverse operation of the
inverse operation of the <function>COALESCE</function> example
<function>COALESCE</function> example given above:
given above:
<programlisting>
<programlisting>
SELECT NULLIF(value, '(none)') ...
SELECT NULLIF(value, '(none)') ...
</programlisting>
</programlisting>
</para>
</para>
<para>
If <replaceable>value1</replaceable> is <literal>(none)</>, return a null,
otherwise return <replaceable>value1</replaceable>.
</para>
</sect2>
</sect2>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment