Example:
This is an example of an UPDATE statement (searched) entered from a terminal. Data for the values of
the dynamic parameter specifications entered from the terminal is updated as a set clause.
7.3.4 Executing prepared statements for which variable attributes are known
When an application program is created, the attributes and the number of dynamic parameter specifications for
prepared statements, or the attributes and the number of select column lists to be fetched may be known. If so, the
SQL descriptor area need not be used and the values can be set or the execution results fetched by specifying
USING arguments.
To set the values of dynamic parameter specifications for a prepared statement by specifying USING arguments, the
values to be set in the argument must be assigned. The number of dynamic parameter specifications in the prepared
statement and the number of arguments must match. The data type of the dynamic parameter specification and that
of the arguments must be comparable. To specify a null value, use an indicator variable.
To fetch the execution results for the prepared statement by specifying USING arguments, specify an argument that
will receive the execution results. The number of select column lists in the prepared statement and the number of
arguments must match. The data type of the select column lists and that of the arguments must be comparable. For
information about comparable data types, see Table "Comparable data types".
Various specification examples follow.
Using the EXECUTE statement to set the values of dynamic parameter speci
fications
Specify USING arguments in the EXECUTE statement to set the values of dynamic parameter specifications.
Example 1:
In this example, a row for which ITMNO is "400", PRODUCT is "VIDEO TAPE", and STOCKQTY is
"500" is added to the STOCK table. The data types of ITMNO, PRODUCT, and STOCKQTY and those
of the three arguments in which the values are to be set must be comparable.
184