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

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

BOOLEAN (Boolean)

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

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

While all RDBMS support BOOLEAN expressions in the form of a org.jooq.Condition, not all RDBMS support Column expressions of type BOOLEAN. If such boolean type support is unavailable in a dialect, jOOQ will just map the type to INTEGER (Integer) with possible values being 0 and 1.

DDL support

Dialect support

This example using jOOQ:

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

Translates to the following dialect specific expressions:

Access, SQLDataWarehouse, SQLServer

CREATE TABLE t (
  c bit
)

ASE, Sybase

CREATE TABLE t (
  c bit NULL
)

Aurora MySQL, Aurora Postgres, CockroachDB, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Postgres, Redshift, SQLite, Snowflake, Trino, Vertica, YugabyteDB

CREATE TABLE t (
  c boolean
)

BigQuery

CREATE TABLE t (
  c bool
)

ClickHouse

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

Databricks

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

DB2

CREATE TABLE t (
  c smallint
)

Oracle, 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"), BOOLEAN)

Translates to the following dialect specific expressions:

Access

cbool(c)

ASE, SQLDataWarehouse, SQLServer, Sybase

CAST(c AS bit)

Aurora MySQL, MariaDB, MemSQL, MySQL

CAST(c AS unsigned)

Aurora Postgres, CockroachDB, Databricks, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, Postgres, Redshift, SQLite, Snowflake, Trino, Vertica, YugabyteDB

CAST(c AS boolean)

BigQuery

CAST(c AS bool)

ClickHouse

CAST(c AS Nullable(boolean))

DB2

CAST(c AS smallint)

Oracle, 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