Previous Topic: SQL Descriptor Area (SQLDA)Next Topic: SQLDA (DESCRIBE or PREPARE INTO Statements)


Determining Number of SQLVAR Entries to Use

Before the DESCRIBE is executed, the value of SQLN must be set to indicate how many occurrences of SQLVAR are provided in the SQLDA. To obtain the description of the columns of the result table of a prepared select-statement, the number of occurrences of SQLVAR must not be less than the number of columns.

When the USING BOTH clause is specified in the DESCRIBE statement, and SQLN is less than twice the size of the SQLD field, SQLD is set to twice the number of columns. When USING BOTH is specified, and SQLN is greater than or equal to twice the size of the SQLD field, SQLD is set to the number of columns.

The following technique is suggested for determining the number of SQLVAR entries to use:

  1. Execute a DESCRIBE or PREPARE statement. The SQLDA that is used must not have any occurrences of SQLVAR. If you use a PREPARE statement, it must use the INTO clause.
  2. If the value that is returned in the SQLD field is: