background image
<< CHAR data type | DATE data type >>

CLOB data type

<< CHAR data type | DATE data type >>
Derby Reference Manual
195
CHAR FOR BIT DATA data type
A CHAR FOR BIT DATA type allows you to store byte strings of a specified length. It is
useful for unstructured data where character strings are not appropriate.
Syntax
{ CHAR | CHARACTER }[(length)] FOR BIT DATA
length is an unsigned integer literal designating the length in bytes.
The default length for a CHAR FOR BIT DATA type is 1., and the maximum size of length
is 254 bytes.
JDBC metadata type (java.sql.Types)
BINARY
CHAR FOR BIT DATA stores fixed-length byte strings. If a CHAR FOR BIT DATA value
is smaller than the target CHAR FOR BIT DATA, it is padded with a 0x20 byte value.
Comparisons of CHAR FOR BIT DATA and VARCHAR FOR BIT DATA values are
precise. For two bit strings to be equal, they must be exactly the same length. (This
differs from the way some other DBMSs handle BINARY values but works as specified in
SQL-92.)
An operation on a VARCHAR FOR BIT DATA and a CHAR FOR BIT DATA value (e.g., a
concatenation) yields a VARCHAR FOR BIT DATA value.
Example
CREATE TABLE t (b CHAR(2) FOR BIT DATA);
INSERT INTO t VALUES (X'DE');
SELECT *
FROM t;
-- yields the following output
B
-----
de20
CLOB data type
A CLOB (character large object) value can be up to 2,147,483,647 characters long. A
CLOB is used to store unicode character-based data, such as large documents in any
character set.
The length is given in number characters for both CLOB, unless one of the suffixes K, M,
or G is given, relating to the multiples of 1024, 1024*1024, 1024*1024*1024 respectively.
Length is specified in characters (unicode) for CLOB.
Syntax
{CLOB |CHARACTER LARGE OBJECT} [ ( length [{K |M |G}] ) ]
Default
A CLOB without a specified length is defaulted to two giga characters (2,147,483,647).
Corresponding compile-time Java type
java.sql.Clob
JDBC metadata type (java.sql.Types)
CLOB