The descriptor area fields include the COUNT field, which exists once for each descriptor area, and the fields of the various items.
Each descriptor item consists of the following fields:
REPETITIONS
TYPE
DATETIME_INTERVAL_CODE
PRECISION
SCALE
LENGTH
INDICATOR
DATA
OCTET_LENGTH
NULLABLE
NAME
UNNAMED
You will find detailed descriptions of the various fields below.
COUNT
The COUNT descriptor area field contains a value for the number of item descriptors used or required.
If the number of item descriptors specified in a DESCRIBE statement is greater than the defined maximum number of items, only the COUNT field is set to the specified number. All other fields are not assigned a value.
SQL data type: SMALLINT
Item descriptor fields
Not all the fields are supplied with a value for each item descriptor. Fields that have not been supplied with a value have an undefined value.
The fields are described in alphabetical order below.
DATA
Is only defined if the value in the INDICATOR field is greater than or equal to 0: Value of the item descriptor.
SQL data type: determined by the fields TYPE, LENGTH, PRECISION, SCALE and DATETIME_INTERVAL_CODE
DATETIME_INTERVAL_CODE
Only for date and time data types:
Data type of the item descriptor.
DATETIME_INTERVAL_CODE | SQL data type |
1 | DATE |
2 | TIME |
3 | TIMESTAMP |
Table 1: Descriptor area field DATETIME_INTERVAL_CODE
SQL data type: SMALLINT
INDICATOR
Information on the value of the item descriptor:
< 0 | Value is the NULL value |
> 0 | Original length of an alphanumeric or national string that was truncated during |
0 | else |
SQL data type: SMALLINT
LENGTH
Only for alphanumeric, national and time data types:
Length of the SQL data type in characters or code units for national data types.
LENGTH | For SQL data type |
length | CHAR(length) |
max | VARCHAR(max) |
cu_length | NCHAR(cu_length) |
cu_max | NVARCHAR(cu_max) |
10 | DATE |
12 | TIME(3) |
23 | TIMESTAMP(3) |
Table 2: Descriptor area field LENGTH
SQL data type: SMALLINT
NAME
Column name if the item refers to a column, otherwise a column name that is used internally.
SQL data type: CHAR(n) or VARCHAR(n), where n >= 128
NULLABLE
Specification of whether the value of the item descriptor can be the NULL value.
1 | Value can be the NULL value |
0 | else |
SQL data type: SMALLINT
OCTET_LENGTH
Maximum memory requirements of the data type indicated by the fields TYPE, LENGTH, PRECISION, SCALE and DATETIME_INTERVAL_CODE in bytes. If these fields do not specify a correct SQL data type, the value of OCTET_LENGTH is undefined.
The value of OCTET_LENGTH is implementation-dependent for numeric and time data types and may change in future versions of SESAM/SQL.
OCTET_LENGTH | For SQL data type |
length | CHAR(length) |
max+2 | VARCHAR(max) |
2*cu_length | NCHAR(cu_length) |
2*cu_max+2 | NVARCHAR(cu_max) |
precision+1 | NUMERIC(precision,scale) |
precision/2+1, if precision even | DECIMAL(precision,scale) |
4 | INTEGER |
2 | SMALLINT |
4, if precision<22 | FLOAT(precision) |
4 | REAL |
8 | DOUBLE PRECISION |
6 | DATE |
8 | TIME(3) |
14 | TIMESTAMP(3) |
Table 3: Descriptor area field OCTET_LENGTH
SQL data type: SMALLINT
PRECISION
Only for numeric data types and TIME and TIMESTAMP:
number of decimal or binary digits of the SQL data type.
PRECISION | For SQL data type |
precision | NUMERIC(precision,scale) |
precision | DECIMAL(precision,scale) |
31 | INTEGER |
15 | SMALLINT |
precision | FLOAT(precision) |
21 | REAL |
53 | DOUBLE PRECISION |
3 | TIME(3) |
3 | TIMESTAMP(3) |
Table 4: Descriptor area field PRECISION
SQL data type: SMALLINT
REPETITIONS
Dimension of a multiple column or aggregate.
A separate item in the descriptor area is used for each occurrence of a multiple column or aggregate. The REPETITIONS field of the first item descriptor contains the number of occurrences or column elements. The REPETITIONS field of all subsequent item descriptors is set to 1.
REPETITIONS is set to 1 for atomic values.
SQL data type: SMALLINT
SCALE
Only for integer and fixed-point number data types:
number of places to the right of the decimal point for the SQL data type.
SCALE | For SQL data type |
scale | NUMERIC(precision,scale) |
scale | DECIMAL(precision,scale) |
0 | INTEGER |
0 | SMALLINT |
Table 5: Descriptor area field SCALE
SQL data type: SMALLINT
TYPE
SQL data type of the item descriptor:
TYPE | SQL data type |
-42 | NVARCHAR |
-31 | NCHAR |
1 | CHAR |
2 | NUMERIC |
3 | DECIMAL |
4 | INTEGER |
5 | SMALLINT |
6 | FLOAT |
7 | REAL |
8 | DOUBLE PRECISION |
9 | DATE, TIME or TIMESTAMP |
12 | VARCHAR |
Table 6: Descriptor area field TYPE
SQL data type: SMALLINT
UNNAMED
Specification of whether the NAME field contains a valid column name.
0 | NAME contains a column name |
1 | else |
SQL data type: SMALLINT