Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

BIT VARYING(n)

Description

A variable-length bit string is represented as BIT VARYING(n), where n is the maximum number of bits. If n is not specified, the length is set to 1,073,741,823 (maximum value).

Remark
  • If the length of the string exceeds n, it will be processed as an error.
  • The remainder of the string is not filled with 0s even if a bit string smaller than n is stored.
  • n must be a number greater than 0.
Example

CREATE TABLE bitvar_tbl(a1 BIT VARYING, a2 BIT VARYING(8));

INSERT INTO bitvar_tbl VALUES (B'1', B'1');

INSERT INTO bitvar_tbl VALUES (0b1010, 0b1010);

INSERT INTO bitvar_tbl VALUES (0xaa, 0xaa);

INSERT INTO bitvar_tbl(a1) VALUES (0xaaa);

SELECT * FROM bitvar_tbl;

 

  a1                    a2

============================================

  X'8'                  X'8'

  X'a'                  X'a'

  X'aa'                 X'aa'

  X'aaa'                NULL

 

INSERT INTO bitvar_tbl(a2) VALUES (0xaaa);

 

ERROR: Data overflow coercing X'aaa' to type bit varying.