SQL/MX 2.x Database and Application Migration Guide (G06.23+, H06.04+, J06.03+)

Converting SQL/MP Applications to SQL/MX
Applications
HP NonStop SQL/MX Database and Application Migration Guide540435-005
10-48
Dynamic SQL
The next list summarizes the dynamic SQL statements that you use with an SQL/MX
descriptor area. For information about the syntax and use of these statements, see the
SQL/MX Reference Manual.
Descriptor Area
NonStop SQL/MP provides a descriptor area (SQLDA) that enables a dynamic SQL
application to exchange information with the database about input parameters and
output columns. You can use the INCLUDE SQLDA directive to declare the descriptor
area.
NonStop SQL/MX does not provide the SQLDA nor the INCLUDE SQLDA directive as
NonStop SQL/MP does. However, NonStop SQL/MX does provide an SQL descriptor
area for dynamic SQL, which consists of multiple item descriptor areas, together with a
count of the number of those item descriptor areas.
In NonStop SQL/MX, you must use the ALLOCATE DESCRIPTOR and DEALLOCATE
DESCRIPTOR statements to allocate and deallocate input and output SQL descriptor
areas. After the parameters are described (using the DESCRIBE statement as in
NonStop SQL/MP), you can only use the SET DESCRIPTOR and GET DESCRIPTOR
statements, respectively, to modify and retrieve information from the descriptor areas.
If you have dynamic input parameters in a prepared SQL statement, you must code the
appropriate 3GL statements and use SET DESCRIPTOR to set the values in the
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; also
allows you to reuse the name of the statement.
DESCRIBE [OUTPUT] Stores in the output descriptor area information
about output values (usually SELECT columns)
from a prepared statement.
DESCRIBE INPUT Stores in the input descriptor area information
about dynamic input parameters for a prepared
statement.
EXECUTE Executes a prepared dynamic SQL statement.
EXECUTE IMMEDIATE Prepares (compiles) and executes a dynamic SQL
statement.