Skip to main content

Common Data Type Classes

This topic provides an overview of the InterSystems IRIS data type classes. 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.

When you choose a data type class to use for a property definition, 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.

Introduction

The most commonly used data type classes are as follows:

Common Data Type Classes
Class Name Holds Notes
%BigIntOpens in a new tab A 64–bit integer This class is similar to %IntegerOpens in a new tab except for its OdbcType and ClientDataType.
%BinaryOpens in a new tab Binary data The actual binary data is sent to and from the client without any Unicode (or other) translations.
%BooleanOpens in a new tab A boolean value The possible logical values are 0 (false) and 1 (true).
%CharOpens in a new tab A fixed length character field  
%CounterOpens in a new tab 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.
%CurrencyOpens in a new tab A currency value This class is defined only for migrating from Sybase or SQL Server to InterSystems IRIS.
%DateOpens in a new tab A date The logical value is in InterSystems IRIS $HOROLOG format.
%DateTimeOpens in a new tab 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.
%DecimalOpens in a new tab A fixed point number The logical value is a decimal format number. See Numeric Computing in InterSystems Applications.
%DoubleOpens in a new tab An IEEE floating-point number The logical value is an IEEE floating-point number. See Numeric Computing in InterSystems Applications.
%EnumStringOpens in a new tab 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.
%ExactStringOpens in a new tab A string A subclass of %StringOpens in a new tab with the EXACT default collation.
%IntegerOpens in a new tab An integer  
%ListOpens in a new tab Data in $List format The logical value is data in $List format.
%ListOfBinaryOpens in a new tab Data in $List format, with each list item as binary data The logical value is data in $List format.
%NameOpens in a new tab 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.
%NumericOpens in a new tab A fixed-point number  
%PosixTimeOpens in a new tab 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.
%SmallIntOpens in a new tab A small integer value This class is the same as %IntegerOpens in a new tab except for its OdbcType.
%StatusOpens in a new tab An error status code 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 in the InterSystems Class Reference.
%StringOpens in a new tab A string  
%TimeOpens in a new tab A time value The logical value is the number of seconds past midnight.
%TimeStampOpens in a new tab 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.

%TinyIntOpens in a new tab 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 “Data Types” in the InterSystems SQL Reference.

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