Initialize the system-descriptor area
The DESCRIBE...USING SQL DESCRIPTOR statement initializes the system-descriptor area with information about the prepared statement.
- It sets the COUNT field, which contains the number of item descriptors
initialized with data.
This value is the number of columns and expressions in the column list (SELECT and INSERT) or the number of returned values (EXECUTE FUNCTION).
- It describes each unknown column in a prepared SELECT statement
(without an INTO TEMP), EXECUTE FUNCTION, or INSERT statement.
The DESCRIBE statement initializes the fields of the item descriptor for each column, as follows:
- It allocates memory for the DATA field based on the TYPE and LENGTH information.
- It initializes the TYPE, LENGTH, NAME, SCALE, PRECISION, and NULLABLE fields to provide information from the database about a column.
For descriptions of these fields, see Fields in each item descriptor of the system-descriptor area.
- It returns the type of SQL statement prepared.
For more information, see Determine the data type of a column.
As noted earlier, the DESCRIBE statement provides information about the columns of a column list. Therefore, you usually use this statement after a SELECT (without an INTO TEMP clause), INSERT, or EXECUTE FUNCTION statement was prepared.