SQL/MX Programming Manual for C and COBOL (H06.10+, J06.03+)
Introduction
HP NonStop SQL/MX Programming Manual for C and COBOL—544617-003
1-8
Using Dynamic SQL Cursors
•
Deallocate resources held by the compiled statement and the SQL descriptor
areas.
See Section 9, Dynamic SQL.
Using Dynamic SQL Cursors
A dynamic SQL program that uses dynamic cursors typically includes declarations and
statements to:
•
Declare a host variable as a place to store the dynamic cursor specification.
•
Prepare the cursor specification.
•
Declare the cursor.
•
Open the cursor.
•
Retrieve the values at the cursor position.
•
Close the cursor.
You can also use SQL descriptor areas with dynamic SQL cursors. If you do, you must
describe the prepared cursor specification.
See Section 10, Dynamic SQL With Descriptor Areas.
Using DML Statements With Rowsets
Use rowsets to retrieve multiple rows from the database into the application for further
processing and to transfer multiple rows of values from the application to the database.
Rowset arrays can be used only from embedded SQL programs. NonStop SQL/MX
does not support rowsets from MXCI.
See Section 7, Static Rowsets and Section 12, Dynamic SQL Rowsets to learn how to
use rowsets in C/C++ or COBOL programs.
Improving Performance by Using Rowsets
Typically, you can use a cursor specified by the SELECT statement to return the
multiple rows that make up the result table of the SELECT to the application. Rows are
returned one at a time. However, the cursor mechanism can produce significant
overhead for an application retrieving many rows from the database.
Rowsets improve the performance of applications by manipulating multiple rows at
once, instead of one at time. Performance is improved because:
•
The number of function calls between the application and NonStop SQL/MX is
reduced by manipulating rows in sets. Network traffic is reduced because the data
for several rows is sent in a single packet.
•
When data is stored in an array, the application can bind all rows in a particular
column with a single bind call and update or delete all rows by executing a single
statement.










