ight="25" width="100"> Smart-Large-Object Data Types

A smart-large-object data type stores text or binary data in sbspaces. (For information about how to create sbspaces, see your Administrator's Guide.) The database server can provide random access to a smart-large-object value. That is, it can access any portion of the smart-large-object value. These data types are recoverable.

The following table summarizes the smart-large-object data types that Dynamic Server supports.

Data Type Purpose
BLOB Stores binary data of up to 4 terabytes (4*240 bytes).
CLOB Stores text data of up to 4 terabytes (4*240 bytes).

For more information, see the entries for these data types in the Informix Guide to SQL: Reference. For information about the built-in functions you use to import, export, and copy smart large objects, see Smart-Large-Object Functions and the Informix Guide to SQL: Tutorial.

Time Data Types

The time data types allow the database server to store increments of time.

The following table summarizes the time data types available.

Data Type Purpose
DATE Stores a date value (mm/dd/yy) as a Julian date.
DATETIME Stores a date and time value (mm/dd/yy hh:mm:ss.fff) in an internal format.
INTERVAL Stores a unit of time such as seconds, hours/minutes, or year/month/day.

User-Defined Data Type

A user-defined data type is a data type that a user defines for the database server.

Element Purpose Restrictions Syntax
distinct_type Name of a distinct data type that has the same structure as an existing data type The name must be different from all other data types in the database. Identifier, p. 4-205
opaque_type Name of the opaque data type The name must be different from all other data types in the database. Identifier, p. 4-205

Dynamic Server supports the following categories of user-defined data types:

Opaque Data Types

An opaque data type is a user-defined data type that can be used in the same way as a built-in data type. To create an opaque type, you must use the CREATE OPAQUE TYPE statement. Because an opaque type is encapsulated, you create support functions to access the individual components of an opaque type. The internal storage details of the type are hidden, or opaque.

For complete information about how to create an opaque type and its support functions, see Extending Informix Dynamic Server 2000.

Distinct Data Types

A distinct data type is a user-defined data type that is based on an existing built-in type, opaque type, named row type, or distinct type. To create a distinct type, you must use the CREATE DISTINCT TYPE statement. For more information, see the CREATE DISTINCT TYPE statement.

Complex Data Type

Complex data types are data types that you create from built-in types, opaque types, distinct types, or other complex types.

Element Purpose Restrictions Syntax
row_type_name Name of a row type created with the CREATE ROW TYPE statement The row type must already exist. Identifier, p. 4-205 Data type, p. 4-53

When you create a complex type, you define the components of the complex type. However, unlike an opaque type, a complex type is not encapsulated. You can use SQL to access the individual components of a complex data type.

Dynamic Server supports the following categories of complex data types:

Named Row Types

You can assign a named row type to a table or a column. To use a named row type to create a typed table or define a column, the named row type must already exist. To create a named row type, see CREATE ROW TYPE.

Unnamed Row Types

An unnamed row type is a group of fields that you create with the ROW constructor. You can use an unnamed row type to define a column. The syntax that you use to define a column as an unnamed row type is shown in the following diagram.

Element Purpose Restrictions Syntax
data_type Data type of the field The field can be any data type except BYTE or TEXT. Data Type, p. 4-53
field Name of a field in the row The name must be unique within the row type. Identifier, p. 4-205

An unnamed row type is identified by its structure. For the syntax you use to specify row values for an unnamed row type, see Expression.

Collection Data Types

The syntax you use to define a column as a collection type is shown in the following diagram.

For the syntax you use to specify collection values for a collection data type, see Collection Constructors.

Element Purpose Restrictions Syntax
element_type Data type of the elements of the collection The element type can be any data type except TEXT, BYTE, SERIAL, or SERIAL8. See also, Defining the Element Type. Data Type, p. 4-53

Privileges on a collection type are those of the column. You cannot specify privileges on specific elements of a collection.

SET Collection Types

A SET is an unordered collection of elements in which each element is unique. You define a column as a SET collection type when you want to store collections whose elements contain no duplicate values and no specific order associated with them.

MULTISET Collection Types

A MULTISET is an unordered collection of elements in which elements can have duplicate values. You define a column as a MULTISET collection type when you want to store collections whose elements might not be unique and have no specific order associated with them.

LIST Collection Types

A LIST is an ordered collection of elements that allows duplicate elements. A LIST differs from a MULTISET in that each element in a LIST collection has an ordinal position in the collection. You define a column as a LIST collection type when you want to store collections whose elements might not be unique but have a specific order associated with them.

Defining the Element Type

The element type can be any data type except TEXT, BYTE, SERIAL, or SERIAL8. You can nest collection types. That is, an element type can be a collection type.

Every element in the collection must be of the same type. For example, if the element type of a collection type is INTEGER, every element in the collection must be of type INTEGER.

If the element type of a collection is an unnamed row type, the unnamed row type cannot contain fields that hold unnamed row types. That is, a collection cannot contain nested unnamed row types.

When you define a column as a collection type, you must specify that the elements of the collection cannot be null. That is, you must use the NOT NULL keywords after you specify the element type.

Related Information

For more information about choosing a data type for your database, see the Informix Guide to Database Design and Implementation.

For more information about the specific qualities of individual data types, see the chapter on data types in the Informix Guide to SQL: Reference.

For more information about multi-byte data types, see the discussion of the NCHAR and NVARCHAR data types and the GLS aspects of other character data types in the Informix Guide to GLS Functionality.


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved