Data Types
This section lists all pre-defined data types.
Character Strings
Char
Data type of a fixed-length character string.
Declaration
CHAR
CHAR(n)
The type can be declared using CHAR(n) where n is the number of code points.
n must have a value between 1 and 2,147,483,647 (both inclusive).
If no length is specified, n is equal to 1.
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.lang.String | Y | Y | Default |
byte[] | Y | Y | Assumes UTF-8 encoding. |
VARCHAR / STRING
Data type of a variable-length character string.
Declaration
VARCHAR
VARCHAR(n)
STRING
The type can be declared using VARCHAR(n) where n is the maximum number of code points.
n must have a value between 1 and 2,147,483,647 (both inclusive).
If no length is specified, n is equal to 1.
STRING is a synonym for VARCHAR(2147483647).
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.lang.String | Y | Y | Default |
byte[] | Y | Y | Assumes UTF-8 encoding. |
Binary Strings
BINARY
Data type of a fixed-length binary string (a sequence of bytes).
Declaration
BINARY
BINARY(n)
The type can be declared using BINARY(n) where n is the number of bytes.
n must have a value between 1 and 2,147,483,647 (both inclusive).
If no length is specified, n is equal to 1.
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
byte[] | Y | Y | Default |
VARBINARY / BYTES
Data type of a variable-length binary string (a sequence of bytes).
Declaration
VARBINARY
VARBINARY(n)
BYTES
The type can be declared using VARBINARY(n) where n is the maximum number of bytes.
n must have a value between 1 and 2,147,483,647 (both inclusive).
If no length is specified, n is equal to 1.
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
byte[] | Y | Y | Default |
Exact Numerics
DECIMAL
Data type of a decimal number with fixed precision and scale.
Declaration
DECIMAL
DECIMAL(p)
DECIMAL(p, s)
DEC
DEC(p)
DEC(p, s)
NUMERIC
NUMERIC(p)
NUMERIC(p, s)
The type can be declared using DECIMAL(p, s) where p is the number of digits in a number (precision) and s is the number of digits to the right of the decimal point in a number (scale).
p must have a value between 1 and 38 (both inclusive).
s must have a value between 0 and p (both inclusive).
The default value for p is 10.The default value for s is 0.
NUMERIC(p, s) and DEC(p, s) are synonyms for this type.
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.math.BigDecimal | Y | Y | Default |
TINYINT
Data type of a 1-byte signed integer with values from -128 to 127.
Declaration
TINYINT
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.lang.Byte | Y | Y | Default |
| byte | Y | (Y) | To JVM only if not nullable. |
SMALLINT
Data type of a 2-byte signed integer with values from -32,768 to 32,767.
Declaration
SMALLINT
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.lang.Short | Y | Y | Default |
| short | Y | (Y) | To JVM only if not nullable. |
INT
Data type of a 4-byte signed integer with values from -2,147,483,648 to 2,147,483,647.
Declaration
INT
INTEGER
INTEGER is a synonym for this type.
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.lang.Integer | Y | Y | Default |
| int | Y | (Y) | To JVM only if not nullable. |
BIGINT
Data type of an 8-byte signed integer with values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Declaration
BIGINT
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.lang.Long | Y | Y | Default |
| long | Y | (Y) | To JVM only if not nullable. |
Approximate Numerics
FLOAT
Data type of a 4-byte single precision floating point number. Compared to the SQL standard, the type does not take parameters.
Declaration
FLOAT
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.lang.Float | Y | Y | Default |
| float | Y | (Y) | To JVM only if not nullable. |
DOUBLE
Data type of an 8-byte double precision floating point number.
Declaration
DOUBLE
DOUBLE PRECISION
DOUBLE PRECISION is a synonym for this type.
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.lang.Double | Y | Y | Default |
| double | Y | (Y) | To JVM only if not nullable. |
Date and Time
DATE
Data type of a date consisting of year-month-day with values ranging from 0000-01-01 to 9999-12-31. Compared to the SQL standard, the range starts at year 0000.
Declaration
DATE
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.time.LocalDate | Y | Y | Default |
| java.sql.Date | Y | Y | N |
| java.sql.Integer | Y | Y | Describes the number of days since epoch. |
| int | Y | (Y) | Describes the number of days since epoch. Output only if not nullable. |
TIME
Data type of a time without time zone consisting of hour:minute:second[.fractional] with up to nanosecond precision and values ranging from 00:00:00.000000000 to 23:59:59.999999999.
Compared to the SQL standard, leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to java.time.LocalTime.
A time with time zone is not provided.
Declaration
TIME
TIME(p)
The type can be declared using TIME(p) where p is the number of digits of fractional seconds (precision).
p must have a value between 0 and 9 (both inclusive).
If no precision is specified, p is equal to 0.
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.time.LocalTime | Y | Y | Default |
| java.sql.Time | Y | Y | N |
| java.lang.Integer | Y | Y | Describes the number of milliseconds of the day. |
| int | Y | (Y) | Describes the number of milliseconds of the day. Output only if not nullable. |
| java.lang.Long | Y | Y | Describes the number of nanoseconds of the day. |
| long | Y | (Y) | Describes the number of nanoseconds of the day. Output only if not nullable. |
TIMESTAMP
Data type of a timestamp without time zone consisting of year-month-day hour:minute:second[.fractional] with up to nanosecond precision and values ranging from 0000-01-01 00:00:00.000000000 to 9999-12-31 23:59:59.999999999.
Compared to the SQL standard, leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to java.time.LocalDateTime.
Declaration
TIMESTAMP
TIMESTAMP(p)
TIMESTAMP WITHOUT TIME ZONE
TIMESTAMP(p) WITHOUT TIME ZONE
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.time.LocalDateTime | Y | Y | Default |
| java.sql.Timestamp | Y | Y | N |
The type can be declared using TIMESTAMP(p) where p is the number of digits of fractional seconds (precision).
p must have a value between 0 and 9 (both inclusive).
If no precision is specified, p is equal to 6.
TIMESTAMP(p) WITHOUT TIME ZONE is a synonym for this type.
TIMESTAMP WITH TIME ZONE
Data type of a timestamp with time zone consisting of year-month-day hour:minute:second[.fractional] zone with up to nanosecond precision and values ranging from 0000-01-01 00:00:00.000000000 +14:59 to 9999-12-31 23:59:59.999999999 -14:59.
Compared to the SQL standard, leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to java.time.OffsetDateTime.
Compared to TIMESTAMP WITH LOCAL TIME ZONE, the time zone offset information is physically stored in every datum.
It is used individually for every computation, visualization, or communication to external systems.
Declaration
TIMESTAMP WITH TIME ZONE
TIMESTAMP(p) WITH TIME ZONE
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.time.OffsetDateTime | Y | Y | Default. |
| java.time.ZonedDateTime | Y | N | Ignores the zone ID. |
TIMESTAMP WITH LOCAL TIME ZONE
Data type of a timestamp with local time zone consisting of year-month-day hour:minute:second[.fractional] zone with up to nanosecond precision and values ranging from 0000-01-01 00:00:00.000000000 +14:59 to 9999-12-31 23:59:59.999999999 -14:59.
Leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to java.time.OffsetDateTime.
Compared to TIMESTAMP WITH TIME ZONE, the time zone offset information is not stored physically in every datum.
For computation and visualization every datum is interpreted in the local time zone as configured in the deployment specification.
This type fills the gap between time zone free and time zone mandatory timestamp types by allowing the interpretation of UTC timestamps according to the configured local time zone.
Declaration
TIMESTAMP WITH LOCAL TIME ZONE
TIMESTAMP(p) WITH LOCAL TIME ZONE
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.time.Instant | Y | Y | Default. The time is returned in UTC, adjusted from the local timezone. |
| java.lang.Integer | Y | Y | Describes the number of seconds since epoch. The time is returned in UTC, adjusted from the local timezone. |
| int | Y | (Y) | Describes the number of seconds since epoch. The time is returned in UTC, adjusted from the local timezone. Output only if not nullable. |
| java.lang.Long | Y | Y | Describes the number of milliseconds since epoch. The time is returned in UTC, adjusted from the local timezone. |
| long | Y | (Y) | Describes the number of milliseconds since epoch. The time is returned in UTC, adjusted from the local timezone. Output only if not nullable. |
INTERVAL YEAR TO MONTH
Data type for a group of year-month interval types.
The type must be parameterized to one of the following resolutions:
- interval of years,
- interval of years to months,
- or interval of months.
An interval of year-month consists of +years-months with values ranging from -9999-11 to +9999-11.
The value representation is the same for all types of resolutions. For example, an interval of months of 50 is always represented in an interval-of-years-to-months format (with default year precision): +04-02.
Declaration
INTERVAL YEAR
INTERVAL YEAR(p)
INTERVAL YEAR(p) TO MONTH
INTERVAL MONTH
The type can be declared using the above combinations where p is the number of digits of years (year precision). p must have a value between 1 and 4 (both inclusive). If no year precision is specified, p is equal to 2.
| Java Type | From JVM | To JVM | Remarks |
|---|---|---|---|
| java.time.Period | Y | Y | Ignores the day part. Default |
| java.lang.Integer | Y | Y | Describes the number of months. |
| int | Y | (Y) | Describes the number of months. Output only if not nullable. |