Specifying the Domain Data Type

From InterBase

Go Up to Creating Domains (Data Definition Guide)


The <data_type> is the only required attribute that must be set for the domain, all other attributes are optional. 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:
The <data_type> is the SQL data type for any column based on a domain. You cannot override the domain data type with a local column definition.

The general categories of SQL data types 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 date and time.
  • 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.

For more information about data types, see Specifying Data Types.

The following statement creates a domain that defines an array of CHARACTER data type:

CREATE DOMAIN DEPTARRAY AS CHAR(67) [4:5];

The next statement creates a BLOB domain with a text subtype that has an assigned character set:

CREATE DOMAIN DESCRIPT AS BLOB SUB_TYPE TEXT SEGMENT SIZE 80
 CHARACTER SET SJIS;

Advance To: