SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
10-1
10
Dynamic SQL With Descriptor Areas
Use dynamic SQL statements to construct, compile, and execute SQL statements
during run time. Use the descriptor areas of NonStop SQL/MX to store information on
each input parameter and output variable in a dynamic statement.
This section describes:
•
Statements for Dynamic SQL With Descriptors on page 10-1
•
SQL Descriptor Areas on page 10-2
•
Input Parameters on page 10-3
•
Output Variables on page 10-7
•
Steps for Using SQL Item Descriptor Areas on page 10-12
•
Using SQL Descriptor Areas to Select SQL/MP KANJI and KSC5601 Data on
page 10-21
•
Using SQL Descriptor Areas to Retrieve ISO88591 Data to UCS2 Host Variables
on page 10-21
Statements for Dynamic SQL With Descriptors
These statements for dynamic SQL use descriptor areas:
ALLOCATE DESCRIPTOR Allocates an input or output SQL descriptor area.
DEALLOCATE
DESCRIPTOR
Deallocates an SQL descriptor area.
GET DESCRIPTOR Retrieves information from an SQL descriptor
area—the COUNT of the item descriptor areas and
specified fields in the areas.
SET DESCRIPTOR Modifies information in an SQL descriptor area.
PREPARE Prepares (compiles) a dynamic SQL statement for
subsequent execution by an EXECUTE statement.
DEALLOCATE PREPARE Deallocates a prepared statement and returns the
system resources used by the statement. It also
allows you to reuse the name of the statement.
DESCRIBE INPUT Stores in the descriptor area information on
dynamic input parameters for a prepared statement.
DESCRIBE [OUTPUT] Stores in the descriptor area information on output
values (usually SELECT columns) from a prepared
statement.
EXECUTE Executes a prepared dynamic SQL statement.
EXECUTE IMMEDIATE Prepares (compiles) and executes a dynamic SQL
statement.