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

CHAR (String)

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

The CHAR data type represents a fixed length string type, or java.lang.String in Java, or Types.CHAR in JDBC.

Given the fixed size characteristic, the CHAR type should be accompanied by an explicit length flag.

DDL support

Dialect support

This example using jOOQ:

createTable("t").column("c", CHAR(3))

Translates to the following dialect specific expressions:

Access

CREATE TABLE t (
  c character(3)
)

ASE, Sybase

CREATE TABLE t (
  c char(3) NULL
)

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

CREATE TABLE t (
  c char(3)
)

BigQuery

CREATE TABLE t (
  c string
)

ClickHouse

CREATE TABLE t (
  c Nullable(char(3))
)
ENGINE Log()

Databricks

CREATE TABLE t (
  c char(3)
)
TBLPROPERTIES(
  'delta.columnMapping.mode' = 'name',
  'delta.feature.allowColumnDefaults' = 'supported'
)
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"), CHAR(3))

Translates to the following dialect specific expressions:

Access

cstr(c)

ASE, Aurora MySQL, Aurora Postgres, CockroachDB, DB2, Databricks, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Postgres, Redshift, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Sybase, Teradata, Trino, Vertica, YugabyteDB

CAST(c AS char(3))

BigQuery

CAST(c AS string)

ClickHouse

CAST(c AS Nullable(char(3)))

Oracle

CAST(c AS varchar2(3))
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