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
)

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 */

(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