SET DESCRIPTOR statement
The SET DESCRIPTOR statement sets the data type and value of the dynamic parameter specification in the SQL
descriptor area. Specify them using the constant or host variable. The data type of the host variable must match the
data type of each set identifier. When the descriptor name specified in the SET DESCRIPTOR statement is specified
in a dynamic OPEN statement, the cursor must be closed.
An example of modifying the data type of the dynamic parameter specification in the SQL descriptor area and setting
a value is shown below. In the example, the data type of host variable vardata in which the value to be set is stored is
assume to be declared as CHARACTER(11). Change the data type of the dynamic parameter specification to
CHARACTER(10). The element number of the item descriptor area to be set should be the value set in varwcount.
This section describes only the SQL statements used to manipulate a SQL descriptor area containing dynamic
parameter specification information. For information about other SQL statements, see "7.2.2 Preparing SQL
statements and manipulating the SQL descriptor area."
7.3.2.1 Preparing and executing dynamic SELECT statements (for SQL descri
ptor area)
To fetch data continuously, prepare and execute a dynamic SELECT statement. "Figure: Example of an application
program that uses the SQL descriptor area (with dynamic parameter specification)" shows an example of an
application program that uses the SQL descriptor area to execute a dynamic SELECT statement with the dynamic
parameter specification.
Example:
This is an example of a dynamic SELECT statement entered from a terminal. Data is searched using
the value of the dynamic parameter specification entered from the terminal as the search condition,
and the value is displayed.
173