skip to main content
Basic elements of SQL : Data types
 

Data types

The following table describes the supported SQL data types.
 
Table 2: Supported SQL data types 
SQL type
Description
BIGINT
Signed 64-bit integer.
BINARY (n)
Binary data of fixed length n (1 <= n <= 255).
BIT
Single bit binary data (0 or 1).
CHAR (n)
Character string of fixed string length n (1 <= n <=254).
DATE
Date data.
DECIMAL(p,s)
Signed, exact, numeric value with a precision p and scale s (1<=p<=127, 0<=s<=p).
DOUBLE PRECISION
Signed, approximate, numeric value with a mantissa precision 15 (0 or absolute value 10 -38 to 1038)
FLOAT
Signed, approximate, numeric value with a mantissa precision 15 (0 or absolute value 10-38 to 1038)
INTEGER
Exact numeric value with precision 10 and scale 0. (signed: -231
<=n <=2 31 -1, unsigned: 0<=n<=232 –1).
LONG VARCHAR
Variable-length string of any size less than 2 GB.
LONG VARBINARY
Variable-length binary data. Length is data source specific. Used for BLOB.
NUMERIC (p, s)
Signed, exact, numeric value with a precision p and scale s (1<=p<=127, 0<=s<=p).
REAL
Signed, approximate, numeric value with a mantissa precision 7 (0 or absolute value 10-38 to 1038)
SMALLINT
Exact numeric value with precision 5 and scale 0. (signed: -32,768 <=n <=32,767, unsigned:0<=n<=65,535).
TIME
Time data.
TIMESTAMP
Date/time data.
TINYINT
Exact numeric value with precision 3 and scale 0.
signed: -128 <=n<=127
unsigned: 0<=n<=255
VARCHAR (n)
Variable-length character string with a maximum string length which is data source dependent.
WCHAR (n)
Unicode character string of fixed string length n (1 <= n <=254).
WLONGVARCHAR
Variable-length Unicode string of any size < 2GB.
WVARCHAR (n)
Variable-length unicode character string with a maximum string length which is data source dependent.