apache > db
Apache DB Project
 
Font size:      

CHAR FOR BIT DATA

CHAR FOR BIT DATA

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.

Examples

CREATE TABLE t (b CHAR(2) FOR BIT DATA);
INSERT INTO t VALUES (X'DE');
SELECT *
FROM t;
 -- yields the following output 
B
-----
de20


Previous Page
Next Page
Table of Contents
Index