Available in versions: Dev (3.21) | Latest (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

BIT (Boolean)

Supported by ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The BIT data type represents a boolean type, or java.lang.Boolean in Java, or Types.BIT in JDBC.

Some RDBMS use BIT to represent a bit string, instead, i.e. a set of boolean values instead of a single one. This usage is currently not supported by jOOQ.

DDL support

Dialect support

This example using jOOQ:

createTable("t").column("c", BIT)

Translates to the following dialect specific expressions:

Access, Aurora MySQL, BigQuery, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, MariaDB, MemSQL, MySQL, SQLDataWarehouse, SQLServer, Trino

CREATE TABLE t (
  c bit
)

ASE, Sybase

CREATE TABLE t (
  c bit NULL
)

Aurora Postgres, CockroachDB, Derby, Informix, Postgres, Redshift, SQLite, Vertica, YugabyteDB

CREATE TABLE t (
  c boolean
)

ClickHouse

CREATE TABLE t (
  c Nullable(bit)
)
ENGINE Log()

Databricks

CREATE TABLE t (
  c bit
)
TBLPROPERTIES(
  'delta.columnMapping.mode' = 'name',
  'delta.feature.allowColumnDefaults' = 'supported'
)

DB2

CREATE TABLE t (
  c smallint
)

Oracle, Snowflake, Teradata

CREATE TABLE t (
  c number
)
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website

Cast support

Dialect support

This example using jOOQ:

cast(field("c"), BIT)

Translates to the following dialect specific expressions:

Access

cbool(c)

ASE, BigQuery, Databricks, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, SQLDataWarehouse, SQLServer, Sybase, Trino

CAST(c AS bit)

Aurora MySQL, MariaDB, MemSQL, MySQL

CAST(c AS unsigned)

Aurora Postgres, CockroachDB, Derby, Informix, Postgres, Redshift, SQLite, Vertica, YugabyteDB

CAST(c AS boolean)

ClickHouse

CAST(c AS Nullable(bit))

DB2

CAST(c AS smallint)

Oracle, Snowflake, Teradata

CAST(c AS number(1))
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo