Fujitsu J2X0-1634-01EN Computer Accessories User Manual


 
references the cursor corresponding to the SQL statement identifier is also deallocated. However, if the prepared
statement is a dynamic SELECT statement, the cursor corresponding to the SQL statement identifier must have
already been closed.
An example of specifying the PREPARE statement is shown below. The SQL statement to be prepared for execution
is assumed to be stored in SQL statement variable str. The SQL statement identifier of this SQL statement is defined
as STM.
Deallocating an SQL statement
Use the DEALLOCATE PREPARE statement to deallocate the prepared statement prepared by the PREPARE
statement.
If the prepared statement is a dynamic SELECT statement, the statement prepared for a preparable dynamic
UPDATE or DELETE statement (positioned) that references the cursor corresponding to the SQL statement identifier
is also deallocated. In this case, the cursor must have already been closed.
An example of specifying the DEALLOCATE PREPARE statement is shown below. The prepared statement for which
the PREPARE statement defined the SQL statement identifier as STM is assumed to be the prepared statement that
will be deallocated.
SQL statements used to manipulate the SQLDA structure
As shown in "Figure: Procedure for fetching execution results for a prepared statement," use the DESCRIBE
statement to fetch select column list information from the database to the SQLDA structure. The DESCRIBE
statement and its functions are explained below.
DESCRIBE statement
The DESCRIBE statement fetches select column list information for the prepared statement prepared by the
PREPARE statement to the SQLDA structure. This type of statement is called an output DESCRIBE statement. The
following is an example of the DESCRIBE statement that fetches select column list information for the prepared
statement corresponding to SQL statement identifier STM2 to the SQLDA structure.
If the prepared statement for SQL statement identifier STM2 is the statement shown below, the contents of the
SQLDA structure are as follows:
140