ANSI SQL Data Types

TimesTen supports ANSI SQL data types. These data types are converted to TimesTen data types with data stored as TimesTen data types. Table 1-2 shows how the ANSI SQL data types are mapped to TimesTen data types.

Table 1-2 Data type mapping: ANSI SQL to TImesTen

ANSI SQL data type TimesTen data type

CHARACTER VARYING(n[BYTE|CHAR]) or

CHAR VARYING(n[BYTE|CHAR])

VARCHAR2(n[BYTE|CHAR])

Character semantics is supported.

DOUBLE [PRECISION]

NUMBER

Floating-point number with a binary precision of 126.

Alternatively, specify FLOAT(126).

FLOAT[(b)]

NUMBER

Floating-point number with binary precision b. Acceptable values for b are between 1 and 126 (binary digits).

FLOAT is an exact numeric type. Use FLOAT to define a column with a floated scale and a specified precision. A floated scale is supported with the NUMBER type, but you cannot specify the precision. A lower precision requires less space, so because you can specify a precision with FLOAT, it may be more desirable than NUMBER. If you do not specify b, then the default precision is 126 binary (38 decimal).

BINARY_FLOAT and BINARY_DOUBLE are inexact numeric types and are therefore different floating types than FLOAT. In addition, the semantics are different between FLOAT and BINARY_FLOAT/BINARY_DOUBLE because BINARY_FLOAT and BINARY_DOUBLE conform to the IEEE standard.

Internally, FLOAT is implemented as type NUMBER.

INT[EGER]

NUMBER(38,0)

TT_INTEGER is a native 32-bit integer type. Use TT_INTEGER, as this data type is more compact and offers faster performance than the NUMBER type.

NATIONAL CHARACTER(n) or

NATIONAL CHAR(n)

NCHAR(n)

NATIONAL CHARACTER VARYING(n) or

NATIONAL CHAR VARYING(n) or

NCHAR VARYING(n)

NVARCHAR2(n)

NUMERIC[(p[,s])] or

DEC[IMAL][(p[,s])]

NUMBER(p,s)

Specifies a fixed-point number with precision p and scale s. This can only be used for fixed-point numbers. If no scale is specified, s defaults to 0.

REAL

NUMBER

Floating-point number with a binary precision of 63.

Alternatively, specify FLOAT(63).

SMALLINT

NUMBER(38,0)

TT_SMALLINT is a native signed integer data type. Using TT_SMALLINT is more compact and offers faster performance than the NUMBER type.