Data Types (Language Reference Guide)

From InterBase
Jump to: navigation, search

Go Up to SQL Statement and Function Reference


InterBase supports most SQL data types, a dynamically sizable data type called a Blob, and arrays of data types. It does not support arrays of Blobs. The following table lists the data types available to SQL statements in InterBase:

Data types supported by InterBase
Name Size Range/Precision Description

BLOB

Variable

  • None
  • Blob segment size is limited to 64K.
  • Dynamically sizable data type for storing large data such as graphics, text, and digitized voice.
  • Basic structural unit is the segment.
  • Blob subtype describes Blob contents.

BOOLEAN

16 bits

  • TRUE
  • FALSE
  • UNKNOWN
  • Represents truth values TRUE, FALSE, and UNKNOWN.
  • Requires ODS 11 or higher, any dialect.

CHAR(<n>)

<n> characters

  • 1 to 32,767 bytes
  • Character set character size determines the maximum number of characters that can fit in 32K.
  • Fixed length CHAR or text string type
  • Alternate keyword: CHARACTER

DATE

32 bits, signed1

1 Jan 100 a.d. to 29 Feb 32768 a.d.

ISC_DATE; stores a date as a 32-bit longword.

DECIMAL ­(<precision>, <­scale>)

Variable
(16, 32, or
64 bits)

  • <precision> = 1 to 18; specifies at least <precision> digits of precision to store.
  • <scale> = 1 to 18; specifies number of decimal places for storage.
  • Must be less than or equal to <precision>.
  • Number with a decimal point <scale> digits from the right
  • Example: DECIMAL(10, 3) holds numbers accurately in the following ­format: ppppppp.sss

DOUBLE ­PRECISION

64 bits2

2.225 x 10–308 to 1.797 x 10308

IEEE double precision: 15 digits

FLOAT

32 bits

1.175 x 10–38 to 3.402 x 1038

IEEE single precision: 7 digits

INTEGER

32 bits

–2,147,483,648 to 2,147,483,647

Signed long (longword)

NUMERIC ­(<precision>, <­scale>)

Variable

(16, 32, or
64 bits)

  • <precision> = 1 to 18; specifies exactly <precision> digits of precision to store.
  • <scale> = 1 to 18; specifies number of decimal places for storage.
  • Must be less than or equal to <precision>.
  • Number with a decimal point <scale> digits from the right
  • Example: NUMERIC(10,3) holds numbers accurately in the following ­format: ppppppp.sss

SMALLINT

16 bits

–32,768 to 32,767

Signed short (word)

TIME

32 bits, unsigned

0:00 AM to 23:59.9999 PM

ISC_TIME

TIMESTAMP

64 bits

1 Jan 100 a.d. to 29 Feb 32768 a.d.

Also includes time information.

VARCHAR (<n>)

<n> characters

  • 1 to 32,765 bytes
  • Character set character size determines the maximum number of characters that can fit in 32K.
  • Variable length CHAR or text string type
  • Alternate keywords: CHAR VARYING, CHARACTER VARYING
  1. InterBase version 5 had a DATE data type that was 64 bits long and included both the date and time. InterBase version 6 and later recognizes that type if you have specified dialect 1; in dialect 3, that type is called TIMESTAMP.
  2. Actual size of DOUBLE is platform-dependent. Most platforms support the 64-bit size.

Advance To: