Specifying the Data Type

From InterBase
Jump to: navigation, search

When creating a table, you must specify the data type for each column. The data type defines the set of valid data that the column can contain. The data type also determines the set of allowable operations that can be performed on the data, and defines the disk space requirements for each data item.

Syntax

<data type> =
 {SMALLINT|INTEGER|FLOAT|DOUBLE PRECISION} [<array_dim>]
 | {DATE|TIME|TIMESTAMP} [<array_dim>]
 | {DECIMAL | NUMERIC} [(precision [, scale])] [<array_dim>]
 | {CHAR | CHARACTER | CHARACTER VARYING | VARCHAR} [(int)][<array_dim>] [CHARACTER SET charname]
 | {NCHAR | NATIONAL CHARACTER | NATIONAL CHAR}[VARYING] [(int)] [<array_dim>]
 | BLOB [SUB_TYPE {int | subtype_name}] [SEGMENT SIZE int][CHARACTER SET charname]
 | BLOB [(seglen [, subtype])]
 | BOOLEAN
<array_dim> = [x:y [, x1:y1 ...]]
Note: <subtype_name> can be a TEXT value.
Note: The outermost brackets must be included when declaring arrays.

Supported data types

The general categories of data types that are supported include:

  • Character data types.
  • Integer data types.
  • Decimal data types, both fixed and floating.
  • A DATE data type to represent the date, a TIME data type to represent the time, and a TIMESTAMP data type to represent both the date and time.
  • A BOOLEAN data type.
  • A BLOB data type to represent unstructured binary data, such as graphics and digitized voice.
  • Arrays of data types (except for BLOB data).

See About InterBase Data Types for a complete list and description of data types that InterBase supports.