Available in versions: Dev (3.21) | Latest (3.20) | 3.19 | 3.18

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.

YEAR (Year)

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

The YEAR data type represents a YEAR value, or java.time.Year in Java. It has no representation in JDBC.

DDL support

Dialect support

This example using jOOQ:

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

Translates to the following dialect specific expressions:

Access, Aurora Postgres, CockroachDB, DB2, Derby, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, Postgres, Redshift, SQLDataWarehouse, SQLServer, SQLite, Teradata, Trino, Vertica, YugabyteDB

CREATE TABLE t (
  c smallint
)

ASE, Sybase

CREATE TABLE t (
  c smallint NULL
)

Aurora MySQL, MariaDB, MemSQL, MySQL

CREATE TABLE t (
  c year
)

BigQuery

CREATE TABLE t (
  c int64
)

ClickHouse

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

Databricks

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

Oracle, Snowflake

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"), YEAR)

Translates to the following dialect specific expressions:

Access

cstr(c)

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

CAST(c AS smallint)

Aurora MySQL

CAST(c AS year)

BigQuery

CAST(c AS int64)

ClickHouse

CAST(c AS Nullable(smallint))

MariaDB, MemSQL, MySQL

CAST(c AS signed)

Oracle, Snowflake

CAST(c AS number(4))
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