SQL/MP Programming Manual for C

Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for C429847-008
10-2
Dynamic SQL Statements
Dynamic SQL Statements
You can perform most of the same operations using dynamic SQL statements that you
can perform with static SQL statements, including DDL, DML, and DCL statements and
SQL cursors. Table 10-1 summarizes the dynamic SQL statements that you can use in
a C program.
These statements are described following. For the syntax of each statement, see the
SQL/MP Reference Manual.
Table 10-1. Dynamic SQL Statements
Statement Description
DESCRIBE INPUT Returns information about input parameters associated with a
prepared SQL statement.
DESCRIBE Returns information about output variables (usually SELECT
columns) associated with a prepared SQL statement.
PREPARE Dynamically compiles an SQL statement stored in a host
variable and associates the prepared statement with a
statement name (an SQL identifier) or a host-variable name.
EXECUTE Runs a prepared SQL statement.
EXECUTE IMMEDIATE Compiles and runs an SQL statement stored in a host
variable.
DECLARE CURSOR Defines an SQL cursor and associates the cursor with a
SELECT statement.
OPEN Opens an SQL cursor: Runs the associated SELECT
statement and positions the cursor before the first row
specified by the SELECT statement so that subsequent
FETCH statements can retrieve data. Optional USING clause
provides values for dynamic parameters.
FETCH Positions an SQL cursor at the next row of the result table
defined by the associated SELECT statement and then
retrieves data into host variables.
RELEASE Deallocates space in the host-language program for a
dynamic SQL statement prepared from a host variable.
CLOSE Closes an SQL cursor and frees the result table defined by
the associated SELECT statement.