Create Distinct Type -- Fields and controls
-
Source data type
-
Length

Source data type
Use this box to specify the DB2 built-in data type
to be used as the source data type for the
distinct type. The data
type can be one of:
- INTEGER
- For a large integer.
- SMALLINT
- For a small integer.
- DECIMAL
- For a decimal number.
- REAL
- For a single-precision floating-point number.
- DOUBLE
- For a double-precision floating-point number.
- CHARACTER
- For a fixed-length character string.
- VARCHAR
- For a varying-length character string.
- GRAPHIC
- For a fixed-length graphic string.
- VARGRAPHIC
- For a varying-length graphic string.
- CLOB
- For a character large
object string. A CLOB column has
a varying length and is a long
string column regardless of its length.
- BLOB
- For a binary large object. A BLOB column
has a varying length and is a long string
column regardless of its length.
- DBCLOB
- For a double-byte character large object
string of the specified maximum length in
double-byte characters. A DBCLOB column
has a varying length and is a long
string column regardless of length.
- DATE
- For a date.
- TIME
- For a time.
- TIMESTAMP
- For a timestamp.
- ROWID
- For a row ID type. A table
can have only one ROWID column. The
values in a ROWID column are unique
for every row in the table and
cannot be updated. DB2 implicitly
defines a ROWID column as NOT NULL.
Length
Use this field to specify the length (byte count)
of the columns based on the specified data type:
- CHARACTER
- Length of the fixed-length character string,
which can range from 1 to 255. The default
is 1.
- VARCHAR
- Maximum length of the varying-length character
string, which can range from 1 to
the maximum record size minus 8 bytes.
The maximum record size
depends on the page size of the table
space (the size of its
buffer) where this distinct type will be used
and whether an edit procedure is specified
for the table where
this distinct type will be used.
The maximum record size when there's no edit
procedure on the table is:
- 4056, for a 4 KB page size.
- 8138, for an 8 KB page size.
- 16330, for a 16 KB page size.
- 32714, for a 32 KB page size.
and when there is an edit procedure on the table:
- 4046, for a 4 KB page size.
- 8128, for an 8 KB page size.
- 16320, for a 16 KB page size.
- 32704, for a 32 KB page size.
Therefore, the maximum VARCHAR length that you can specify when
there is not an edit procedure is:
- 4048, for a 4 KB page size.
- 8130, for a 8 KB page size.
- 16322, for a 16 KB page size.
- 32706, for a 32 KB page size.
and when there is an edit procedure, the maximum VARCHAR length is:
- 4038, for a 4 KB page size.
- 8120, for a 8 KB page size.
- 16312, for a 16 KB page size.
- 32696, for a 32 KB page size.
- GRAPHIC
- Length of the fixed-length graphic string, which can range
from 1 to 127. The default is 1.
- VARGRAPHIC
- Maximum length of the varying-length graphic string,
which can range from 1 to N/2, where N is the maximum
row size minus 2 bytes.
- CLOB
- Length of the character large object string. The value
that you can type in this field for a CLOB can range from:
- 1 to 2 147 483 647 if you select Bytes
as the measuring unit.
- 1 to 2 097 152 if you select K-Bytes as
the measuring unit.
- 1 to 2048 if you select M-Bytes as
the measuring unit.
- 1 to 2 if you select G-Bytes as
the measuring unit.
If you specify a value that evaluates to 2 GB (2 147 483 648 bytes),
DB2 uses a value that is one byte less (2 147 483 647 bytes).
- BLOB
- Length of the binary large object string. The range of the value
you can type in this field for a BLOB is the same as for a CLOB.
- DBCLOB
- Length of the double-byte character large object string.
the value you can type in this field for a DBCLOB can range from:
- 1 to 1 073 741 824 if you select Bytes
as the measuring unit.
- 1 to 1 048 576 if you select K-Bytes as
the measuring unit.
- 1 to 1024 if you select M-Bytes as
the measuring unit.
- If you select G-Bytes, you can type a 1.