Setting the TYPE or ITYPE Field
Use these integer values to set the value
of TYPE or ITYPE for each item.
SQL Data Type | Integer Value | X-Open Integer Value | SQL Data Type | Integer Value | X-Open Integer Value |
---|---|---|---|---|---|
CHAR | 0 | 1 | MONEY | 8 | – |
SMALLINT | 1 | 4 | DATETIME | 10 | – |
INTEGER | 2 | 5 | BYTE | 11 | – |
FLOAT | 3 | 6 | TEXT | 12 | – |
SMALLFLOAT | 4 | – | VARCHAR | 13 | – |
DECIMAL | 5 | 3 | INTERVAL | 14 | – |
SERIAL | 6 | – | NCHAR | 15 | – |
DATE | 7 | – | NVARCHAR | 16 | – |
The following table lists integer values that represent additional
data types available with HCL
OneDB™.
SQL Data Type | Integer Value | SQL Data Type | Integer Value |
---|---|---|---|
INT8 | 17 | Fixed-length OPAQUE type | 41 |
SERIAL8 | 18 | LVARCHAR (client-side only) | 43 |
SET | 19 | BOOLEAN | 45 |
MULTISET | 20 | BIGINT | 52 |
LIST | 21 | BIGSERIAL | 53 |
ROW (unnamed) | 22 | IDSSECURITYLABEL | 2061 |
COLLECTION | 23 | ROW (named) | 4118 |
Variable-length OPAQUE type | 40 |
The same TYPE constants can also appear in the syscolumns.coltype column in the system catalog; see HCL OneDB Guide to SQL: Reference.
For code that is easier to maintain, use the predefined constants for these SQL data types instead of their actual integer values. These constants are defined in the $INFORMIX/incl/public/sqltypes.h header file. You cannot, however, use the actual constant name in the SET DESCRIPTOR statement. Instead, assign the constant to an integer host variable and specify the host variable in the SET DESCRIPTOR statement file.
The following example shows how you can set the TYPE field
in :
main() { EXEC SQL BEGIN DECLARE SECTION; int itemno, type; EXEC SQL END DECLARE SECTION; ... EXEC SQL allocate descriptor 'desc1' with max 5; ... type = SQLINT; itemno = 3; EXEC SQL set descriptor 'desc1' value :itemno type = :type; }
This information is identical for ITYPE. Use ITYPE when you create a dynamic program that does not comply with the X/Open standard.