- •Firebird Null Guide
- •Table of Contents
- •Introduction
- •What is NULL?
- •NULL in expressions
- •Expressions returning NULL
- •NULL in boolean expressions
- •More logic (or not)
- •NULL in aggregate functions
- •NULL handling in UDFs
- •NULL <-> non-NULL conversions you didn't ask for
- •Being prepared for undesired conversions
- •More on UDFs
- •NULL in if statements
- •Testing if something is NULL
- •Setting a field or variable to NULL
- •Dealing with NULLs
- •Testing for NULL - if it matters
- •Finding out if fields are the same
- •Finding out if a field has changed
- •Substituting NULL with a value
- •The COALESCE function
- •Firebird 1.0: the *NVL functions
- •Summary
- •Document history
- •License notice
Firebird Null Guide
Summary
NULL in a nutshell:
•NULL means unknown.
•If NULL figures in an expression, most of the time the entire expression becomes NULL.
•In aggregate functions only non-NULL fields are involved in the computation. Exception:
COUNT(*).
•UDFs sometimes convert NULL <-> non-NULL in a seemingly random manner.
•If the test expression of an if statement is NULL, the then block is skipped and the else block executed.
• To find out if A is NULL, use “A is (not) null”.
•The COALESCE and *NVL functions can convert NULL to a value.
•Assigning NULL is done like assigning values: with “A = NULL” or an insert list.
Remember, this is how NULL works in Firebird SQL. There may be (subtle) differences with other RDBMSes.
13
Firebird Null Guide
Appendix A:
Document history
The exact file history is recorded in the manual module in our CVS tree; see http://sourceforge.net/ cvs/?group_id=9028
Revision History |
|
|
|
0.1 |
8 April 2005 |
PV |
First edition. |
0.2 |
15 April 2005 |
PV |
Mentioned that Fb 2.0 legalises “A = NULL” comparisons. |
|
|
|
Changed text in “Testing if something is NULL”. |
|
|
|
Slightly altered “Dealing with NULLs” section. |
14
Firebird Null Guide
Appendix B:
License notice
The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the “License”); you may only use this Documentation if you comply with the terms of this License. Copies of the License are available at http://www.firebirdsql.org/pdfmanual/pdl.pdf (PDF) and http:// www.firebirdsql.org/manual/pdl.html (HTML).
The Original Documentation is titled Firebird Null Guide.
The Initial Writer of the Original Documentation is: Paul Vinkenoog.
Copyright (C) 2005. All Rights Reserved. Initial Writer contact: paulvink at users dot sourceforge dot net.
15