Skip to main content

Common Data Type Classes

This topic provides an overview of the InterSystems IRIS data type classes, which you typically use to define literal properties. Each data type class specifies several keywords that control how that data type is used in InterSystems SQL and how the data type is projected to client systems. You should choose a class that has the appropriate client projection, if applicable, for your needs. If there is no suitable class, you can create your own data type class, as described in Defining Data Type Classes.

Note that each data type class also uses one or more property parameters, whose default values you can override within your property definition.

Introduction

The most commonly used data type classes are as follows:

Holds a 64–bit integer. This class is similar to %IntegerOpens in a new tab except for its OdbcType and ClientDataType.

Holds binary data. The actual binary data is sent to and from the client without any Unicode (or other) translations.

Holds a boolean value. The possible logical values are 0 (false) and 1 (true).

Holds a fixed length character field.

Holds an integer, meant for use as a unique counter. Any property whose type class is %CounterOpens in a new tab will be assigned a value when a new object is saved or a new record is inserted via SQL, if no value is specified for that property. For details, see %CounterOpens in a new tab in the InterSystems Class Reference.

Holds a currency value. This class is defined only for migrating from Sybase or SQL Server to InterSystems IRIS.

Holds a date. The logical value is in InterSystems IRIS $HOROLOG format.

Holds a date and time. This class is used mainly for T-SQL migrations and maps datetime/smalldatetime behavior to the %TimeStampOpens in a new tab datatype. In this class, the DisplayToLogical() and OdbcToLogical() methods provide logic to handle imprecise datetime values that are supported by T-SQL applications.

Holds a fixed point number. The logical value is a decimal format number. See Numeric Computing in InterSystems Applications.

Holds an IEEE floating-point number. The logical value is an IEEE floating-point number. See Numeric Computing in InterSystems Applications.

Holds a string. This is a specialized subclass of %StringOpens in a new tab that allows you to define an enumerated set of possible values (using the DISPLAYLIST and VALUELIST parameters). Unlike %StringOpens in a new tab, the display values for this property are used when columns of this type are queried via ODBC.

Holds a string. This is a subclass of %StringOpens in a new tab with the EXACT default collation.

Holds an integer.

Holds data in $List format. The logical value is data in $List format.

Holds data in $List format, with each list item as binary data. The logical value is data in $List format.

Holds a name in the form “Lastname,Firstname”. The %NameOpens in a new tab data type has special indexing support when used in conjunction with the %Storage.Persistent class. For details, see %NameOpens in a new tab in the InterSystems Class Reference.

Holds a fixed-point number.

Holds a value for a time and date. The logical value of this data type is the number of seconds since (or before) January 1, 1970 00:00:00, encoded as a 64-bit integer. %PosixTimeOpens in a new tab uses less disk space and memory than %TimeStampOpens in a new tab data type, and is better for performance than %TimeStampOpens in a new tab.

Holds a small integer value. This class is the same as %IntegerOpens in a new tab except for its OdbcType.

Holds an error status code and status information. Many methods in the InterSystems IRIS Class Library return values of type %StatusOpens in a new tab. For information on working with these values, see %StatusOpens in a new tab.

Holds a string. For %StringOpens in a new tab, the default maximum length is 50 characters. You can override this by setting the MAXLEN parameter.

Holds a time value. The logical value is the number of seconds past midnight.

Holds a value for a time and date. The logical value of the %TimeStampOpens in a new tab data type is in YYYY-MM-DD HH:MM:SS.nnnnnnnnn format. Note that if h is a date/time value in $H format, then you can use the $ZDATETIME as follows to obtain a valid logical value for a %TimeStampOpens in a new tab property: $ZDATETIME(h,3)

Also see the comments for %PosixTimeOpens in a new tab.

Holds a very small integer value. This class is the same as %IntegerOpens in a new tab except for its OdbcType and its maximum and minimum values.

There are many additional data type classes, intended for specialized uses; most of these types are subclasses of the classes listed here. See the InterSystems Class Reference for details.

Data Type Classes Grouped by SqlCategory

For a data type class, the SqlCategory class keyword specifies the SQL category that InterSystems SQL uses when operating on values of properties of that type. Operations controlled by SqlCategory include comparison operations (such as greater than, less than, or equal to); other operations may also use it. The following table shows the SqlCategory values of the data types listed in this topic.

Data Type Classes Grouped by SqlCategory
Value InterSystems IRIS Data Type
DATE %DateOpens in a new tab
DOUBLE %DoubleOpens in a new tab
INTEGER %BigIntOpens in a new tab, %BooleanOpens in a new tab, %CounterOpens in a new tab, %IntegerOpens in a new tab, %SmallIntOpens in a new tab, %TinyIntOpens in a new tab
NAME %NameOpens in a new tab
NUMERIC %CurrencyOpens in a new tab, %DecimalOpens in a new tab, %NumericOpens in a new tab
POSIXTS %PosixTimeOpens in a new tab
STRING %BinaryOpens in a new tab, %CharOpens in a new tab, %EnumStringOpens in a new tab, %ExactStringOpens in a new tab, %ListOpens in a new tab, %ListOfBinaryOpens in a new tab, %StatusOpens in a new tab, %StringOpens in a new tab
TIME %TimeOpens in a new tab
TIMESTAMP %DateTimeOpens in a new tab, %TimeStampOpens in a new tab

For further information on how literal properties are projected to SQL types, see SQL Data Types.

Data Type Classes Grouped by OdbcType

For a data type class, the OdbcType class keyword controls how InterSystems IRIS translates logical data values to and from values used by the InterSystems SQL ODBC interface. The following table shows the OdbcType values of the data types listed in this topic.

Data Type Classes Grouped by OdbcType
Value InterSystems IRIS Data Type
BIGINT %BigIntOpens in a new tab
BIT %BooleanOpens in a new tab
DATE %DateOpens in a new tab
DOUBLE %DoubleOpens in a new tab
INTEGER %CounterOpens in a new tab, %IntegerOpens in a new tab
NUMERIC %CurrencyOpens in a new tab, %DecimalOpens in a new tab, %NumericOpens in a new tab
TIME %TimeOpens in a new tab
TIMESTAMP %DateTimeOpens in a new tab, %PosixTimeOpens in a new tab, %TimeStampOpens in a new tab
VARBINARY %BinaryOpens in a new tab
VARCHAR %CharOpens in a new tab, %EnumStringOpens in a new tab, %ExactStringOpens in a new tab, %ListOpens in a new tab, %ListOfBinaryOpens in a new tab, %NameOpens in a new tab, %StatusOpens in a new tab, %StringOpens in a new tab

Data Type Classes Grouped by ClientDataType

For a data type class, the ClientDataType class keyword controls how InterSystems IRIS projects a property (of that type) to Java or Active X. The following table shows the ClientDataType values of the data types listed in this topic.

Data Type Classes Grouped by ClientDataType
Value Used for
BIGINT %BigIntOpens in a new tab
BINARY %BinaryOpens in a new tab (or any property requiring that there is no Unicode conversion of data)
CURRENCY %CurrencyOpens in a new tab
DATE %DateOpens in a new tab
DOUBLE %DoubleOpens in a new tab
DECIMAL %DecimalOpens in a new tab
INTEGER %CounterOpens in a new tab, %IntegerOpens in a new tab, %SmallIntOpens in a new tab, %TinyIntOpens in a new tab
LIST %ListOpens in a new tab, %ListOfBinaryOpens in a new tab
NUMERIC %NumericOpens in a new tab
TIME %TimeOpens in a new tab
TIMESTAMP %DateTimeOpens in a new tab, %PosixTimeOpens in a new tab, %TimeStampOpens in a new tab
VARCHAR %CharOpens in a new tab, %EnumStringOpens in a new tab, %ExactStringOpens in a new tab, %NameOpens in a new tab, %StringOpens in a new tab

See Also

FeedbackOpens in a new tab