VARCHAR FOR BIT DATA

The VARCHAR FOR BIT DATA type allows you to store binary strings less than or equal to a specified length. It is useful for unstructured data where character strings are not appropriate (e.g., images).

Syntax

{ VARCHAR | CHAR VARYING | CHARACTER VARYING } (length) FOR BIT DATA 

length is an unsigned integer literal designating the length in bytes.

Unlike the case for the CHAR FOR BIT DATA type, there is no default length for a VARCHAR FOR BIT DATA type. The maximum size of the length value is 32,672 bytes.

JDBC metadata type (java.sql.Types)

VARBINARY

VARCHAR FOR BIT DATA stores variable-length byte strings. Unlike CHAR FOR BIT DATA values, VARCHAR FOR BIT DATA values are not padded out to the target length.

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.

The type of a byte literal is always a VARCHAR FOR BIT DATA, not a CHAR FOR BIT DATA.

Related concepts
Built-In type overview
Numeric types
Related reference
Data type assignments and comparison, sorting, and ordering
BIGINT
BLOB
CHAR
CHAR FOR BIT DATA
CLOB
DATE
DECIMAL
DOUBLE
DOUBLE PRECISION
FLOAT
INTEGER
LONG VARCHAR
LONG VARCHAR FOR BIT DATA
NUMERIC
REAL
SMALLINT
TIME
TIMESTAMP
VARCHAR