Data types
Db2 supports both IBM®-supplied data types (built-in data types) and user-defined data types (distinct types).
The smallest unit of data that can be manipulated in SQL is called a value. How values are interpreted depends on the data type of their source. Values have the following sources:
- Columns
- Constants
- Expressions
- Functions
- Special registers
- Variables (such as host variables, SQL variables, global variables, parameter markers, and parameters of routines)
The following topics describes the built-in data types and distinct types.
NULLS
All data types include the null value. Distinct from all nonnull values, the null value is a special value that denotes the absence of a (nonnull) value.
Although all data types include the null value, some sources of values cannot provide the null value. For example, constants, columns that are defined as NOT NULL, and special registers cannot contain null values; the COUNT and COUNT_BIG functions cannot return a null value; and ROWID columns cannot store a null value although a null value can be returned for a ROWID column as the result of a query.