Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9

Temporary tables

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

Many dialects support different notions of "temporary" tables, i.e. tables whose data and/or meta data is stored only temporarily. The details of these temporary are implementation specific. jOOQ supports the following syntaxes, both with explicit column lists or as CREATE TABLE AS SELECT:

// Create a new temporary table
create.createTemporaryTable("book_archive")
      .column("column1", INTEGER)
      .execute();

// Create a new temporary table
create.createGlobalTemporaryTable("book_archive")
      .column("column1", INTEGER)
      .execute();

Dialect support

This example using jOOQ:

createTemporaryTable("book_archive")
      .column("column1", INTEGER)

Translates to the following dialect specific expressions:

-- AURORA_MYSQL, AURORA_POSTGRES, DUCKDB, MARIADB, MEMSQL, MYSQL, POSTGRES, REDSHIFT, YUGABYTEDB
CREATE TEMPORARY TABLE book_archive (
  column1 int
)

-- COCKROACHDB
CREATE GLOBAL TEMPORARY TABLE book_archive (
  column1 int4
)

-- FIREBIRD, HANA, TERADATA
CREATE GLOBAL TEMPORARY TABLE book_archive (
  column1 integer
)

-- ORACLE, SNOWFLAKE
CREATE GLOBAL TEMPORARY TABLE book_archive (
  column1 number(10)
)

-- VERTICA
CREATE GLOBAL TEMPORARY TABLE book_archive (
  column1 int
)

-- ACCESS, ASE, BIGQUERY, DB2, DERBY, EXASOL, H2, HSQLDB, INFORMIX, SQLDATAWAREHOUSE, SQLITE, SQLSERVER, SYBASE, TRINO
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.19, 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