CHAR FOR BIT is a fixed length Binary Data Type.

Syntax

CHAR ( charLength ) FOR BIT DATA

Arguments

  • charLength: The number of bytes for the value.
    • Must be an integer between 1 and 254, inclusive.
    • Values shorter than charLength will be padded with 0x20 values to be charLength.

Binary Type

  • Fixed Length

Storage Size

Defined by the charLength value, which is the number of bytes.

Additional Information

Use this information when declaring column types with the CREATE TABLE statement or casting values to new data_types for use in functions or output.

  • Use the CAST function to cast one value to match the other type.

  • When inserting binary data into a binary type column, precede the value with an ‘X’ identifier.

Examples

CREATE TABLE myTable (
   userName VARCHAR(100),
   bitCode CHAR(5) FOR BIT DATA);

INSERT INTO myTable VALUES (user27, X83x2a);