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

SMALLINT UNSIGNED (UShort)

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

The SMALLINT UNSIGNED data type represents an unsigned, 16 bit integer, or org.jooq.types.UShort in Java. It has no representation in JDBC.

If unsigned support is unavailable in a dialect, jOOQ will just map the type to the next higher integer type INTEGER UNSIGNED (UInteger).

DDL support

Dialect support

This example using jOOQ:

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

Translates to the following dialect specific expressions:

Access

CREATE TABLE t (
  c integer
)

ASE, Sybase

CREATE TABLE t (
  c unsigned smallint NULL
)

Aurora MySQL, BigQuery, DB2, Informix, MariaDB, MemSQL, MySQL, Trino

CREATE TABLE t (
  c smallint unsigned
)

Aurora Postgres, Derby, Exasol, Firebird, H2, HSQLDB, Hana, Postgres, Redshift, SQLDataWarehouse, SQLServer, SQLite, Teradata, Vertica, YugabyteDB

CREATE TABLE t (
  c int
)

ClickHouse

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

CockroachDB

CREATE TABLE t (
  c int4
)

Databricks

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

DuckDB

CREATE TABLE t (
  c usmallint
)

Oracle, Snowflake

CREATE TABLE t (
  c number(5)
)
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"), SMALLINTUNSIGNED)

Translates to the following dialect specific expressions:

Access

cdec(c)

ASE, Sybase

CAST(c AS unsigned smallint)

Aurora MySQL, MariaDB, MemSQL, MySQL

CAST(c AS unsigned)

Aurora Postgres, Derby, Exasol, Firebird, H2, HSQLDB, Hana, Postgres, Redshift, SQLDataWarehouse, SQLServer, SQLite, Teradata, Vertica, YugabyteDB

CAST(c AS int)

BigQuery, DB2, Databricks, Informix, Trino

CAST(c AS smallint unsigned)

ClickHouse

CAST(c AS Nullable(UInt16))

CockroachDB

CAST(c AS int4)

DuckDB

CAST(c AS usmallint)

Oracle, Snowflake

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