# Data types

This section describes the data types used in Derby.

- Built-in type overview
  The SQL type system is used by the language compiler to determine the compile-time type of an expression and by the language execution system to determine the runtime type of an expression, which can be a subtype or implementation of the compile-time type.
- Numeric types
- Data type assignments and comparison, sorting, and ordering
  The tables in this section show valid assignments and comparisons between Derby data types.
- BIGINT data type
  BIGINT provides 8 bytes of storage for integer values.
- BLOB data type
  A BLOB (binary large object) is a varying-length binary string that can be up to 2,147,483,647 characters long. Like other binary types, BLOB strings are not associated with a code page. In addition, BLOB strings do not hold character data.
- BOOLEAN data type
  BOOLEAN provides 1 byte of storage for logical values.
- CHAR data type
  CHAR provides for fixed-length storage of strings.
- CHAR FOR BIT DATA data type
  A CHAR FOR BIT DATA type allows you to store byte strings of a specified length. It is useful for unstructured data where character strings are not appropriate.
- CLOB data type
  A CLOB (character large object) value can be up to 2,147,483,647 characters long. A CLOB is used to store Unicode character-based data, such as large documents in any character set.
- DATE data type
  DATE provides for storage of a year-month-day in the range supported by java.sql.Date.
- DECIMAL data type
  DECIMAL provides an exact numeric in which the precision and scale can be arbitrarily sized.
- DOUBLE data type
  The DOUBLE data type is a synonym for the DOUBLE PRECISION data type.
- DOUBLE PRECISION data type
  The DOUBLE PRECISION data type provides 8-byte storage for numbers using IEEE floating-point notation.
- FLOAT data type
  The FLOAT data type is an alias for a REAL or DOUBLE PRECISION data type, depending on the precision you specify.
- INTEGER data type
  INTEGER provides 4 bytes of storage for integer values.
- LONG VARCHAR data type
  The LONG VARCHAR type allows storage of character strings with a maximum length of 32,700 characters.
- LONG VARCHAR FOR BIT DATA data type
  The LONG VARCHAR FOR BIT DATA type allows storage of bit strings up to 32,700 bytes.
- NUMERIC data type
  NUMERIC is a synonym for DECIMAL and behaves the same way.
- REAL data type
  The REAL data type provides 4 bytes of storage for numbers using IEEE floating-point notation.
- SMALLINT data type
  SMALLINT provides 2 bytes of storage.
- TIME data type
  TIME provides for storage of a time-of-day value.
- TIMESTAMP data type
  TIMESTAMP provides for storage of a combined DATE and TIME value. It permits a fractional-seconds value of up to nine digits.
- User-defined types
  Derby allows you to create user-defined types. A user-defined type is a serializable Java class whose instances are stored in columns. The class must implement the java.io.Serializable interface.
- VARCHAR data type
  VARCHAR provides for variable-length storage of strings.
- VARCHAR FOR BIT DATA data type
  The VARCHAR FOR BIT DATA type allows you to store binary strings less than or equal to a specified length. It is useful for unstructured data where character strings are not appropriate (for example, images).
- XML data type
  The XML data type is used for Extensible Markup Language (XML) documents.

Parent topic: SQL language reference
Related concepts
SQL identifiers
Statements
Built-in system functions
Built-in system procedures
Related reference
Capitalization and special characters
SQL clauses
SQL expressions
JOIN operations
SQL queries
Built-in functions
SYSCS_DIAG diagnostic tables and functions