Class SQLDataType
- java.lang.Object
-
- org.jooq.impl.SQLDataType
-
public final class SQLDataType extends java.lang.Object
The SQL standard data types, as described inTypes
.These types are usually the ones that are referenced by generated source code. Most RDBMS have an almost 1:1 mapping between their vendor-specific types and the ones in this class (except Oracle). Some RDBMS also have extensions, e.g. for geospacial data types. See the dialect-specific data type classes for more information.
- Author:
- Lukas Eder
-
-
Field Summary
Fields Modifier and Type Field Description static DataType<java.lang.Long>
BIGINT
TheTypes.BIGINT
type.static DataType<ULong>
BIGINTUNSIGNED
The unsignedTypes.BIGINT
type.static DataType<byte[]>
BINARY
TheTypes.BINARY
type.static DataType<java.lang.Boolean>
BIT
TheTypes.BIT
type.static DataType<byte[]>
BLOB
TheTypes.BLOB
type.static DataType<java.lang.Boolean>
BOOLEAN
TheTypes.BOOLEAN
type.static DataType<java.lang.String>
CHAR
TheTypes.CHAR
type.static DataType<java.lang.String>
CLOB
TheTypes.CLOB
type.static DataType<java.sql.Date>
DATE
TheTypes.DATE
type.static DataType<java.math.BigDecimal>
DECIMAL
TheTypes.DECIMAL
type.static DataType<java.math.BigInteger>
DECIMAL_INTEGER
The zero-scaleTypes.DECIMAL
type.static DataType<java.lang.Double>
DOUBLE
TheTypes.DOUBLE
type.static DataType<java.lang.Double>
FLOAT
TheTypes.FLOAT
type.static DataType<java.time.Instant>
INSTANT
ATypes.TIMESTAMP_WITH_TIMEZONE
type that uses UTC as time zone.static DataType<java.lang.Integer>
INTEGER
TheTypes.INTEGER
type.static DataType<UInteger>
INTEGERUNSIGNED
The unsignedTypes.INTEGER
type.static DataType<YearToSecond>
INTERVAL
The SQL standardINTERVAL YEAR TO SECOND
data type.static DataType<DayToSecond>
INTERVALDAYTOSECOND
The SQL standardINTERVAL DAY TO SECOND
data type.static DataType<YearToMonth>
INTERVALYEARTOMONTH
The SQL standardINTERVAL YEAR TO MONTH
data type.static DataType<JSON>
JSON
TheJSON
type.static DataType<JSONB>
JSONB
TheJSONB
type.static DataType<java.time.LocalDate>
LOCALDATE
TheTypes.DATE
type.static DataType<java.time.LocalDateTime>
LOCALDATETIME
TheTypes.TIMESTAMP
type.static DataType<java.time.LocalTime>
LOCALTIME
TheTypes.TIME
type.static DataType<java.lang.String>
LONGNVARCHAR
TheTypes.LONGNVARCHAR
type.static DataType<byte[]>
LONGVARBINARY
TheTypes.LONGVARBINARY
type.static DataType<java.lang.String>
LONGVARCHAR
TheTypes.LONGVARCHAR
type.static DataType<java.lang.String>
NCHAR
TheTypes.NCHAR
type.static DataType<java.lang.String>
NCLOB
TheTypes.NCLOB
type.static DataType<java.math.BigDecimal>
NUMERIC
TheTypes.NUMERIC
type.static DataType<java.lang.String>
NVARCHAR
TheTypes.NVARCHAR
type.static DataType<java.time.OffsetDateTime>
OFFSETDATETIME
TheTypes.TIMESTAMP_WITH_TIMEZONE
type.static DataType<java.time.OffsetTime>
OFFSETTIME
TheTypes.TIME_WITH_TIMEZONE
type.static DataType<java.lang.Object>
OTHER
TheTypes.OTHER
type.static DataType<java.lang.Float>
REAL
TheTypes.REAL
type.static DataType<Record>
RECORD
TheTypes.STRUCT
type.static DataType<Result<Record>>
RESULT
TheResultSet
type.static DataType<RowId>
ROWID
TheTypes.ROWID
type.static DataType<java.lang.Short>
SMALLINT
TheTypes.SMALLINT
type.static DataType<UShort>
SMALLINTUNSIGNED
The unsignedTypes.SMALLINT
type.static DataType<java.sql.Time>
TIME
TheTypes.TIME
type.static DataType<java.sql.Timestamp>
TIMESTAMP
TheTypes.TIMESTAMP
type.static DataType<java.time.OffsetDateTime>
TIMESTAMPWITHTIMEZONE
TheTypes.TIMESTAMP_WITH_TIMEZONE
type.static DataType<java.time.OffsetTime>
TIMEWITHTIMEZONE
TheTypes.TIME_WITH_TIMEZONE
type.static DataType<java.lang.Byte>
TINYINT
TheTypes.TINYINT
type.static DataType<UByte>
TINYINTUNSIGNED
The unsignedTypes.TINYINT
type.static DataType<java.util.UUID>
UUID
TheUUID
type.static DataType<byte[]>
VARBINARY
TheTypes.VARBINARY
type.static DataType<java.lang.String>
VARCHAR
TheTypes.VARCHAR
type.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DataType<byte[]>
BINARY(int length)
TheTypes.BINARY
type.static DataType<byte[]>
BLOB(int length)
TheTypes.BLOB
type.static DataType<java.lang.String>
CHAR(int length)
TheTypes.CHAR
type.static DataType<java.lang.String>
CLOB(int length)
TheTypes.CLOB
type.static DataType<java.math.BigDecimal>
DECIMAL(int precision)
TheTypes.DECIMAL
type.static DataType<java.math.BigDecimal>
DECIMAL(int precision, int scale)
TheTypes.DECIMAL
type.static DataType<java.math.BigInteger>
DECIMAL_INTEGER(int precision)
The zero-scaleTypes.DECIMAL
type.static DataType<java.time.Instant>
INSTANT(int precision)
ATypes.TIMESTAMP_WITH_TIMEZONE
type that uses UTC as time zone.static DataType<java.lang.String>
LONGNVARCHAR(int length)
TheTypes.LONGNVARCHAR
type.static DataType<byte[]>
LONGVARBINARY(int length)
TheTypes.LONGVARBINARY
type.static DataType<java.lang.String>
LONGVARCHAR(int length)
TheTypes.LONGVARCHAR
type.static DataType<java.lang.String>
NCHAR(int length)
TheTypes.NCHAR
type.static DataType<java.lang.String>
NCLOB(int length)
TheTypes.NCLOB
type.static DataType<java.math.BigDecimal>
NUMERIC(int precision)
TheTypes.NUMERIC
type.static DataType<java.math.BigDecimal>
NUMERIC(int precision, int scale)
TheTypes.NUMERIC
type.static DataType<java.lang.String>
NVARCHAR(int length)
TheTypes.NVARCHAR
type.static DataType<java.time.OffsetDateTime>
OFFSETDATETIME(int precision)
TheTypes.TIMESTAMP_WITH_TIMEZONE
type.static DataType<java.time.OffsetTime>
OFFSETTIME(int precision)
TheTypes.TIME_WITH_TIMEZONE
type.static DataType<java.sql.Time>
TIME(int precision)
TheTypes.TIME
type.static DataType<java.sql.Timestamp>
TIMESTAMP(int precision)
TheTypes.TIMESTAMP
type.static DataType<java.time.OffsetDateTime>
TIMESTAMPWITHTIMEZONE(int precision)
TheTypes.TIMESTAMP_WITH_TIMEZONE
type.static DataType<java.time.OffsetTime>
TIMEWITHTIMEZONE(int precision)
TheTypes.TIME_WITH_TIMEZONE
type.static DataType<byte[]>
VARBINARY(int length)
TheTypes.VARBINARY
type.static DataType<java.lang.String>
VARCHAR(int length)
TheTypes.VARCHAR
type.
-
-
-
Field Detail
-
VARCHAR
public static final DataType<java.lang.String> VARCHAR
TheTypes.VARCHAR
type.
-
CHAR
public static final DataType<java.lang.String> CHAR
TheTypes.CHAR
type.
-
LONGVARCHAR
public static final DataType<java.lang.String> LONGVARCHAR
TheTypes.LONGVARCHAR
type.
-
CLOB
public static final DataType<java.lang.String> CLOB
TheTypes.CLOB
type.
-
NVARCHAR
public static final DataType<java.lang.String> NVARCHAR
TheTypes.NVARCHAR
type.
-
NCHAR
public static final DataType<java.lang.String> NCHAR
TheTypes.NCHAR
type.
-
LONGNVARCHAR
public static final DataType<java.lang.String> LONGNVARCHAR
TheTypes.LONGNVARCHAR
type.
-
NCLOB
public static final DataType<java.lang.String> NCLOB
TheTypes.NCLOB
type.
-
BOOLEAN
public static final DataType<java.lang.Boolean> BOOLEAN
TheTypes.BOOLEAN
type.
-
BIT
public static final DataType<java.lang.Boolean> BIT
TheTypes.BIT
type.
-
TINYINT
public static final DataType<java.lang.Byte> TINYINT
TheTypes.TINYINT
type.
-
SMALLINT
public static final DataType<java.lang.Short> SMALLINT
TheTypes.SMALLINT
type.
-
INTEGER
public static final DataType<java.lang.Integer> INTEGER
TheTypes.INTEGER
type.
-
BIGINT
public static final DataType<java.lang.Long> BIGINT
TheTypes.BIGINT
type.
-
DECIMAL_INTEGER
public static final DataType<java.math.BigInteger> DECIMAL_INTEGER
The zero-scaleTypes.DECIMAL
type.
-
TINYINTUNSIGNED
public static final DataType<UByte> TINYINTUNSIGNED
The unsignedTypes.TINYINT
type.
-
SMALLINTUNSIGNED
public static final DataType<UShort> SMALLINTUNSIGNED
The unsignedTypes.SMALLINT
type.
-
INTEGERUNSIGNED
public static final DataType<UInteger> INTEGERUNSIGNED
The unsignedTypes.INTEGER
type.
-
DOUBLE
public static final DataType<java.lang.Double> DOUBLE
TheTypes.DOUBLE
type.
-
FLOAT
public static final DataType<java.lang.Double> FLOAT
TheTypes.FLOAT
type.
-
REAL
public static final DataType<java.lang.Float> REAL
TheTypes.REAL
type.
-
NUMERIC
public static final DataType<java.math.BigDecimal> NUMERIC
TheTypes.NUMERIC
type.
-
DECIMAL
public static final DataType<java.math.BigDecimal> DECIMAL
TheTypes.DECIMAL
type.
-
DATE
public static final DataType<java.sql.Date> DATE
TheTypes.DATE
type.
-
TIMESTAMP
public static final DataType<java.sql.Timestamp> TIMESTAMP
TheTypes.TIMESTAMP
type.
-
TIME
public static final DataType<java.sql.Time> TIME
TheTypes.TIME
type.
-
INTERVAL
public static final DataType<YearToSecond> INTERVAL
The SQL standardINTERVAL YEAR TO SECOND
data type.
-
INTERVALYEARTOMONTH
public static final DataType<YearToMonth> INTERVALYEARTOMONTH
The SQL standardINTERVAL YEAR TO MONTH
data type.
-
INTERVALDAYTOSECOND
public static final DataType<DayToSecond> INTERVALDAYTOSECOND
The SQL standardINTERVAL DAY TO SECOND
data type.
-
LOCALDATE
public static final DataType<java.time.LocalDate> LOCALDATE
TheTypes.DATE
type.
-
LOCALTIME
public static final DataType<java.time.LocalTime> LOCALTIME
TheTypes.TIME
type.
-
LOCALDATETIME
public static final DataType<java.time.LocalDateTime> LOCALDATETIME
TheTypes.TIMESTAMP
type.
-
OFFSETTIME
public static final DataType<java.time.OffsetTime> OFFSETTIME
TheTypes.TIME_WITH_TIMEZONE
type.The behaviour of this data type is influenced by the JDBC driver and the database that is used. Some databases support actual time zones (as in
ZonedDateTime
), other databases support only offsets (as inOffsetDateTime
). Some databases retain the actual time zone information that is stored and reproduce it with every fetch (e.g.SQLDialect.ORACLE
), others use this type as a synonym for a timestamp in UTC (e.g.SQLDialect.POSTGRES
), producing possibly a value in the current time zone of the database or the client. Please refer to your database for more information about the behaviour of this data type.
-
OFFSETDATETIME
public static final DataType<java.time.OffsetDateTime> OFFSETDATETIME
TheTypes.TIMESTAMP_WITH_TIMEZONE
type.The behaviour of this data type is influenced by the JDBC driver and the database that is used. Some databases support actual time zones (as in
ZonedDateTime
), other databases support only offsets (as inOffsetDateTime
). Some databases retain the actual time zone information that is stored and reproduce it with every fetch (e.g.SQLDialect.ORACLE
), others use this type as a synonym for a timestamp in UTC (e.g.SQLDialect.POSTGRES
), producing possibly a value in the current time zone of the database or the client. Please refer to your database for more information about the behaviour of this data type.
-
TIMEWITHTIMEZONE
public static final DataType<java.time.OffsetTime> TIMEWITHTIMEZONE
TheTypes.TIME_WITH_TIMEZONE
type.An alias for
OFFSETTIME
-
TIMESTAMPWITHTIMEZONE
public static final DataType<java.time.OffsetDateTime> TIMESTAMPWITHTIMEZONE
TheTypes.TIMESTAMP_WITH_TIMEZONE
type.An alias for
OFFSETDATETIME
-
INSTANT
public static final DataType<java.time.Instant> INSTANT
ATypes.TIMESTAMP_WITH_TIMEZONE
type that uses UTC as time zone.Neither JDBC, nor most SQL databases support the
INSTANT
data type, which is often the only kind of timestamp which can be expected to behave across all server and client time zone settings. This implementation is backed by the database vendor'sTIMESTAMP WITH TIME ZONE
data type implementation, which may (e.g. Oracle) or may not (e.g. PostgreSQL) store the timestamp information. Irrespective of that storage, this type will always produce time zone agnostic instants in client code.
-
BINARY
public static final DataType<byte[]> BINARY
TheTypes.BINARY
type.
-
VARBINARY
public static final DataType<byte[]> VARBINARY
TheTypes.VARBINARY
type.
-
LONGVARBINARY
public static final DataType<byte[]> LONGVARBINARY
TheTypes.LONGVARBINARY
type.
-
BLOB
public static final DataType<byte[]> BLOB
TheTypes.BLOB
type.
-
OTHER
public static final DataType<java.lang.Object> OTHER
TheTypes.OTHER
type.
-
RESULT
public static final DataType<Result<Record>> RESULT
TheResultSet
type.This is not a SQL or JDBC standard. This type emulates REF CURSOR types and similar constructs
-
UUID
public static final DataType<java.util.UUID> UUID
TheUUID
type.This is not a SQL or JDBC standard. This type handles UUID types where they are supported
-
JSON
public static final DataType<JSON> JSON
TheJSON
type.This is not a SQL or JDBC standard. This type handles JSON types where they are supported.
-
-
Method Detail
-
VARCHAR
public static final DataType<java.lang.String> VARCHAR(int length)
TheTypes.VARCHAR
type.
-
CHAR
public static final DataType<java.lang.String> CHAR(int length)
TheTypes.CHAR
type.
-
LONGVARCHAR
public static final DataType<java.lang.String> LONGVARCHAR(int length)
TheTypes.LONGVARCHAR
type.
-
CLOB
public static final DataType<java.lang.String> CLOB(int length)
TheTypes.CLOB
type.
-
NVARCHAR
public static final DataType<java.lang.String> NVARCHAR(int length)
TheTypes.NVARCHAR
type.
-
NCHAR
public static final DataType<java.lang.String> NCHAR(int length)
TheTypes.NCHAR
type.
-
LONGNVARCHAR
public static final DataType<java.lang.String> LONGNVARCHAR(int length)
TheTypes.LONGNVARCHAR
type.
-
NCLOB
public static final DataType<java.lang.String> NCLOB(int length)
TheTypes.NCLOB
type.
-
DECIMAL_INTEGER
public static final DataType<java.math.BigInteger> DECIMAL_INTEGER(int precision)
The zero-scaleTypes.DECIMAL
type.
-
NUMERIC
public static final DataType<java.math.BigDecimal> NUMERIC(int precision)
TheTypes.NUMERIC
type.
-
NUMERIC
public static final DataType<java.math.BigDecimal> NUMERIC(int precision, int scale)
TheTypes.NUMERIC
type.
-
DECIMAL
public static final DataType<java.math.BigDecimal> DECIMAL(int precision)
TheTypes.DECIMAL
type.
-
DECIMAL
public static final DataType<java.math.BigDecimal> DECIMAL(int precision, int scale)
TheTypes.DECIMAL
type.
-
TIMESTAMP
public static final DataType<java.sql.Timestamp> TIMESTAMP(int precision)
TheTypes.TIMESTAMP
type.
-
TIME
public static final DataType<java.sql.Time> TIME(int precision)
TheTypes.TIME
type.
-
OFFSETTIME
public static final DataType<java.time.OffsetTime> OFFSETTIME(int precision)
TheTypes.TIME_WITH_TIMEZONE
type.The behaviour of this data type is influenced by the JDBC driver and the database that is used. Some databases support actual time zones (as in
ZonedDateTime
), other databases support only offsets (as inOffsetDateTime
). Some databases retain the actual time zone information that is stored and reproduce it with every fetch (e.g.SQLDialect.ORACLE
), others use this type as a synonym for a timestamp in UTC (e.g.SQLDialect.POSTGRES
), producing possibly a value in the current time zone of the database or the client. Please refer to your database for more information about the behaviour of this data type.
-
OFFSETDATETIME
public static final DataType<java.time.OffsetDateTime> OFFSETDATETIME(int precision)
TheTypes.TIMESTAMP_WITH_TIMEZONE
type.The behaviour of this data type is influenced by the JDBC driver and the database that is used. Some databases support actual time zones (as in
ZonedDateTime
), other databases support only offsets (as inOffsetDateTime
). Some databases retain the actual time zone information that is stored and reproduce it with every fetch (e.g.SQLDialect.ORACLE
), others use this type as a synonym for a timestamp in UTC (e.g.SQLDialect.POSTGRES
), producing possibly a value in the current time zone of the database or the client. Please refer to your database for more information about the behaviour of this data type.
-
TIMEWITHTIMEZONE
public static final DataType<java.time.OffsetTime> TIMEWITHTIMEZONE(int precision)
TheTypes.TIME_WITH_TIMEZONE
type.An alias for
OFFSETTIME
-
TIMESTAMPWITHTIMEZONE
public static final DataType<java.time.OffsetDateTime> TIMESTAMPWITHTIMEZONE(int precision)
TheTypes.TIMESTAMP_WITH_TIMEZONE
type.An alias for
OFFSETDATETIME
-
INSTANT
public static final DataType<java.time.Instant> INSTANT(int precision)
ATypes.TIMESTAMP_WITH_TIMEZONE
type that uses UTC as time zone.Neither JDBC, nor most SQL databases support the
INSTANT
data type, which is often the only kind of timestamp which can be expected to behave across all server and client time zone settings. This implementation is backed by the database vendor'sTIMESTAMP WITH TIME ZONE
data type implementation, which may (e.g. Oracle) or may not (e.g. PostgreSQL) store the timestamp information. Irrespective of that storage, this type will always produce time zone agnostic instants in client code.
-
BINARY
public static final DataType<byte[]> BINARY(int length)
TheTypes.BINARY
type.
-
VARBINARY
public static final DataType<byte[]> VARBINARY(int length)
TheTypes.VARBINARY
type.
-
LONGVARBINARY
public static final DataType<byte[]> LONGVARBINARY(int length)
TheTypes.LONGVARBINARY
type.
-
BLOB
public static final DataType<byte[]> BLOB(int length)
TheTypes.BLOB
type.
-
-