Determine the data type of a column
The DESCRIBE statement identifies the data type of a column with an integer value.
After DESCRIBE analyzes a prepared statement, it stores
this value in a dynamic-management structure, as follows:
- In a system-descriptor area, in the TYPE field of the item descriptor for each column described
- In an sqlda structure, in the sqltype field of the sqlvar_struct structure for each column described
provides
defined constants for these data types in the following two header
files:
- The sqltypes.h header file contains defined constants for the SQL data types that are specific to HCL OneDB™. These values are the default that the DESCRIBE statement uses.
- The sqlxtype.h header file contains defined constants for the X/Open SQL data types. DESCRIBE uses these values when you compile your source file with the -xopen option of the preprocessor.
Use the SQL data type constants from sqltypes.h or sqlxtype.h to
analyze the information returned by a DESCRIBE statement or to set
the data type of a column before execution.
Tip: When
you set the data type of a column in a system-descriptor area, you
assign a data type constant to the TYPE field (and optionally the
ITYPE field) of an item descriptor with the SET DESCRIPTOR statement. When
you set the data type of a column in an sqlda structure, you
assign a data type constant to the sqltype field (and optionally
the sqlitype field) of an sqlvar structure.