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
DECIMAL (BigDecimal)
Supported by ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The DECIMAL data type represents a decimal number, or java.math.BigDecimal in Java, or Types.DECIMAL in JDBC.
Given the variable precision characteristic, the DECIMAL type should usually be accompanied by explicit precision and scale flags. If absent, the default behaviour is dialect specific.
For most practical purposes, the DECIMAL type is the same as the NUMERIC type.
createTable("t").column("c", DECIMAL(10, 5))
Translates to the following dialect specific expressions:
Access
CREATE TABLE t ( c numeric(10, 5) )
ASE, Sybase
CREATE TABLE t ( c decimal(10, 5) NULL )
Aurora MySQL, Aurora Postgres, CockroachDB, DB2, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Postgres, Redshift, SQLDataWarehouse, SQLServer, SQLite, Teradata, Trino, Vertica, YugabyteDB
CREATE TABLE t ( c decimal(10, 5) )
BigQuery
CREATE TABLE t ( c decimal )
ClickHouse
CREATE TABLE t ( c Nullable(decimal(10, 5)) ) ENGINE Log()
Databricks
CREATE TABLE t ( c decimal(10, 5) ) TBLPROPERTIES( 'delta.columnMapping.mode' = 'name', 'delta.feature.allowColumnDefaults' = 'supported' )
Snowflake
CREATE TABLE t ( c number(10, 5) )
Spanner
CREATE TABLE t ( c numeric )
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website
cast(field("c"), DECIMAL(10, 5))
Translates to the following dialect specific expressions:
Access
cdec(c)
ASE, Aurora MySQL, Aurora Postgres, CockroachDB, DB2, Databricks, DuckDB, Exasol, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Postgres, Redshift, SQLDataWarehouse, SQLServer, SQLite, Sybase, Teradata, Trino, Vertica, YugabyteDB
CAST(c AS decimal(10, 5))
BigQuery
CAST(c AS decimal)
ClickHouse
CAST(c AS Nullable(decimal(10, 5)))
Snowflake
CAST(c AS number(10, 5))
Spanner
CAST(c AS numeric)
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!