Bit value data type

2026-03-06 07:02:43  Updated

The BIT type is used to store bit values.

A bit value is specified by using the b'value' notation. Here, value is a binary value written in zeros and ones. For example, b'111' indicates 7, and b'10000000' indicates 128.

The syntax is as follows:

BIT[(M)]

Here, M specifies the total number of digits in the value. The range of M is [1,64]. If M is not specified, the value of M is 1.

When you insert a value into the BIT(M) column, if the length of the inserted value is less than M, the value is left-padded with zeros. For example, if b'101' is inserted into BIT(6), it is equivalent to inserting b'000101'.

Contact Us