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.

VARCHAR (String)

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

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

Given the variable size characteristic, the VARCHAR type may or may not be accompanied by an explicit length flag. If absent, the default in most dialects is to set the maximum length available.

DDL support

Dialect support

This example using jOOQ:

createTable("t").column("c", VARCHAR(16))

Translates to the following dialect specific expressions:

Access

CREATE TABLE t (
  c text(16)
)

ASE, Sybase

CREATE TABLE t (
  c varchar(16) NULL
)

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

CREATE TABLE t (
  c varchar(16)
)

BigQuery

CREATE TABLE t (
  c string
)

ClickHouse

CREATE TABLE t (
  c Nullable(String(16))
)
ENGINE Log()

CockroachDB

CREATE TABLE t (
  c string(16)
)

Databricks

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

Informix

CREATE TABLE t (
  c lvarchar(16)
)

Oracle

CREATE TABLE t (
  c varchar2(16)
)
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"), VARCHAR(16))

Translates to the following dialect specific expressions:

Access

cstr(c)

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

CAST(c AS varchar(16))

Aurora MySQL, MariaDB, MemSQL, MySQL

CAST(c AS char(16))

BigQuery

CAST(c AS string)

ClickHouse

CAST(c AS Nullable(String(16)))

CockroachDB

CAST(c AS string(16))

Informix

CAST(c AS lvarchar(16))

Oracle

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