Data Type Details

Numeric Data Types

Exasol supports approximately and exact numerical data types. The difference when using the approximate data types arises from the possible rounding differences, which can occur due to the type of storage and the way computations are performed. Information losses of this nature do not occur when using exact numeric types because of the type of storage.

Exasol Type (ANSI type) Range (min.,max.) Precision Note
Exact numeric type
DECIMAL(p,s) Precision, Scale: (p,s)

s ≤ p≤ 36

p ≥ 1 and s ≥ 0

Approximate numeric type
DOUBLE PRECISION [-1.7∙10308,+1.7∙10308] ~15 digits About 15 digits can be stored, independent of the scale. The special element NaN is interpreted as NULL, the element Infinity is not supported.

Boolean Data Type

The ANSIClosedAmerican National Standards Institute SQL standard data type BOOLEAN is directly supported in Exasol.

Exasol Type (ANSI type) Range Note
BOOLEAN TRUE, FALSE NULL/UNKNOWN

Instead of Boolean literals, the following numbers and strings can be interpreted: 

TRUE: 1, '1', 'T', 't', 'TRUE' (case insensitive)

FALSE: 0,'0','F','f','FALSE' (case-insensitive)

Date/Time Data Types

Of the various data types of the ANSI SQL standard, Exasol currently supports the DATE and TIMESTAMP types. DATE corresponds to a date. In addition to the date, TIMESTAMP contains the time. Additionally, the data types TIMESTAMP WITH LOCAL TIME ZONE considers the session time zone. For more information, see ALTER SESSION and SESSIONTIMEZONE.

Exasol Type (ANSI type) Range Note
DATE 01.01.0001 to 31.12.9999  
TIMESTAMP 01.01.0001 00:00:00.000 to 31.12.9999 23:59:59.999 The accuracy is limited to milliseconds
TIMESTAMP WITH LOCAL TIME ZONE 01.01.0001 00:00:00.000 to 31.12.9999 23:59:59.999 The range is as in TIMESTAMP type, however, this type also considers the time zone. The accuracy is limited to milliseconds.

Other considerations for data type TIMESTAMP WITH LOCAL TIME ZONE

  • In case of TIMESTAMP WITH LOCAL TIME ZONE columns, the timestamps are internally normalized to UTC, while the input and output values are interpreted in the session time zone. Hence, users in different time zones can easily insert and display data without having to worry about the internal storage. However, you should be aware that executing the similar SQL statement in sessions with different time zones can lead to different results.
  • While TIMESTAMP is a simple structure consisting of year, month, day, hour, minute, and second, data of type TIMESTAMP WITH LOCAL TIME ZONE represents a specific moment on the time axis. Internally, the data is normalized to UTC, because within the certain time zones exist time shifts (for example, when switching from winter to summer time) and ambiguous periods (for example, when switching from summer to winter time). If such problematic data is inserted within the local session time zone, the session value TIME_ZONE_BEHAVIOR (changeable by ALTER SESSION) defines the course of action.

The string for option TIME_ZONE_BEHAVIOR consists of two parts:

INVALID

When the time is set ahead in a time zone, then there is a gap. If timestamps are located within this gap, it can be treated in the following different ways:

SHIFT - Corrects the value by adding the daylight saving time offset (typically one hour)

ADJUST - Rounds the value the first valid value after the time shift

NULLIFY - Sets the value to NULL

REJECT - Throws an exception

AMBIGUOUS

When the time is moved backward in a time zone, then ambiguous timestamps exist which can be treated in the following different ways:

ST - Interprets the value in Standard Time (ST)

DST - Interprets the values in Daylight Saving Time (DST)

NULLIFY - Sets the value to NULL

REJECT - Throws an exception

Therefore, the following combinations can be defined:

'INVALID SHIFT AMBIGUOUS ST'
'INVALID SHIFT AMBIGUOUS DST'
'INVALID SHIFT AMBIGUOUS NULLIFY'
'INVALID SHIFT AMBIGUOUS REJECT'
'INVALID ADJUST AMBIGUOUS ST'
'INVALID ADJUST AMBIGUOUS DST'
'INVALID ADJUST AMBIGUOUS NULLIFY'
'INVALID ADJUST AMBIGUOUS REJECT'
'INVALID NULLIFY AMBIGUOUS ST'
'INVALID NULLIFY AMBIGUOUS DST'
'INVALID NULLIFY AMBIGUOUS NULLIFY'
'INVALID NULLIFY AMBIGUOUS REJECT'
'INVALID REJECT AMBIGUOUS ST'
'INVALID REJECT AMBIGUOUS DST'
'INVALID REJECT AMBIGUOUS NULLIFY'
'INVALID REJECT AMBIGUOUS REJECT'

  • When casting between the data types TIMESTAMP WITH LOCAL TIME ZONE and TIMESTAMP, the session time zone is evaluated and the TIMESTAMP WITH LOCAL TIME ZONE is transformed into a normal TIMESTAMP data type. This approach is similar approach to displaying a TIMESTAMP WITH LOCAL TIME ZONE value. For example, in your database client, the internal UTC normalized value is also converted to TIMESTAMP data type, considering the session time zone.
  • There are no special literals for the data type TIMESTAMP WITH LOCAL TIME ZONE. The literal for data type TIMESTAMP is considered and the session time zone defines the corresponding moment on the time axis. Details about the arithmetic on datetime values and the datetime functions, refer to Scalar Functions and Operators sections. For information on literals, refer to Literals section.
  • The time stamp values logged in statistical system tables are rendered in the database time zone (DBTIMEZONE) which can be set from EXAoperation. This is particularly relevant if you want to use the different functions for the current timestamp:
Time Stamp Description
SYSTIMESTAMP Returns the current timestamp, rendered in the database time zone (DB-TIMEZONE)
CURRENT_TIMESTAMP Retuns the current timestamp, rendered in the session time zone (SESSION_TIMEZONE)
LOCALTIMESTAMP Equivalent to CURRENT_TIMESTAMP
NOW() Equivalent to CURRENT_TIMESTAMP
  • The list of supported time zones can be found in the system table EXA_TIME_ZONES.

Interval Data Types

Using the interval data types you can define time periods which are especially useful for datetime arithmetic.

Exasol Type (ANSI type) Range Note
INTERVAL YEAR [(p)] TO MONTH

'-999999999-11' to '999999999-11'

For example: '5-3'

1 ≤ p ≤ 9 (default: 2)
INTERVAL DAY [(p)] TO SECOND [(fp)]

'-999999999 23:59:59.999' to '999999999 23:59:59.999'

For example: '2 12:50:10.123'

1 ≤ p ≤ 9 (default: 2), 0 ≤ fp ≤ 9 (default: 3)

The accuracy is limited to milliseconds.

Geospatial data type

The geospatial data type can store various geometry objects. For more information, refer to Geospatial Data section.

Exasol Type (ANSI type) Possible Elements Note
GEOMETRY [(srid)] POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPLYGON, GEOMETRYCOLLECTION srid defines the coordinate system. For more information, see EXA_SPATIAL_REF_SYS.

String Data Types

There are two ANSIClosedAmerican National Standards Institute SQL standard type supported in Exasol for characters: CHAR and VARCHAR.

The CHAR(n) data type has a fixed and pre-defined length n. When you insert a value that is shorter than the pre-defined length, then spacing characters (padding) are used to fill the space. The length is limited to 2000 characters and you can use ASCII or UTF8 (Unicode) to define the character set.

VARCHAR(n) can contain any string of the length n or smaller. These strings are stored in their respective length. The maximum allowed length is 2,000,000 characters and you can use ASCII or UTF8 (Unicode) to define the character set.

In both CHAR(n) and VARCHAR(n), if no character set is defined, by default UTF8 will be considered.

Exasol Type (ANSI type) Character Set Note
CHAR(n) ASCII, UTF8 1 ≤ n ≤ 2,000
VARCHAR(n) ASCII, UTF8 1 ≤ n ≤ 2,000,000

An empty string is evaluated as NULL value.

To display the character set of a certain column you can use the DESC[RIBE] command.

stringtype_definition::=