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 SQL descriptor area
As shown in "Figure: Procedure for fetching execution results for a prepared statement," use SQL statements to fetch
select column list information from the database to the SQL descriptor area and to fetch the select column list
information placed in the SQL descriptor area. The SQL statements used to manipulate the SQL descriptor area and
their functions are explained below.
ALLOCATE DESCRIPTOR statement
The ALLOCATE DESCRIPTOR statement allocates the SQL descriptor area for the specified descriptor name. The
allocated SQL descriptor area contains the number of item descriptor areas specified in this instance.
An example of allocating the SQL descriptor area with descriptor name DESC1 is shown below. In this example, the
number of item descriptor areas in the SQL descriptor area is assumed to be 200.
DEALLOCATE DESCRIPTOR statement
The DEALLOCATE DESCRIPTOR statement deallocates the SQL descriptor area allocated by the ALLOCATE
DESCRIPTOR statement. If the descriptor name specified by the DEALLOCATE DESCRIPTOR statement is also
151