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

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
)

Oracle

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

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

/* UNSUPPORTED */

(These are currently generated with jOOQ 3.20, see #10141), or translate your own on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo