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

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.

CREATE TYPE .. AS OBJECT

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

jOOQ supports creating standard SQL composite types

// Create a new ENUM type
create.createType("point")
      .as(field("x", INTEGER), field("y", INTEGER))
      .execute();

Dialect support

This example using jOOQ:

createType("point").as(field("x", INTEGER), field("y", INTEGER))

Translates to the following dialect specific expressions:

Aurora Postgres, Postgres, YugabyteDB

CREATE TYPE point AS (
  x int,
  y int
)

CockroachDB

CREATE TYPE point AS (
  x int4,
  y int4
)

DuckDB

CREATE TYPE point AS STRUCT (
  x int,
  y int
)

Oracle

CREATE TYPE point AS OBJECT (
  x number(10),
  y number(10)
)

ASE, Access, Aurora MySQL, BigQuery, ClickHouse, DB2, Derby, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Redshift, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Sybase, Teradata, Trino, Vertica

/* UNSUPPORTED */
Generated with jOOQ 3.20. 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