EasyManua.ls Logo

HP NonStop SQL/MP

HP NonStop SQL/MP
331 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for C429847-008
10-24
Specify the INCLUDE STRUCTURES Directive
Specify the INCLUDE STRUCTURES Directive
Specify the INCLUDE STRUCTURES directive to indicate the version of SQL
structures you plan to use:
EXEC SQL INCLUDE STRUCTURES ALL VERSION 315;
For more information about the INCLUDE STRUCTURES directive, see Section 9,
Error and Status Reporting.
Declare the SQLDA Structure and Names Buffer
Declare the SQLDA structure to generate a template to use later in the program:
EXEC SQL INCLUDE SQLDA (dummy_sqlda, 1, dummy_namesbuf,1);
For more information about the INCLUDE SQLDA directive, see SQLDA Structure,
Names Buffer, and Collation Buffer on page 10-3.
Declare an SQLSA Structure
Declare an SQLSA structure using the INCLUDE SQLSA directive:
EXEC SQL INCLUDE SQLSA;
For more information about the INCLUDE SQLSA directive, see Section 9, Error and
Status Reporting.
Process the Input Parameters
If the input_num field in the SQLSA structure is greater than 0 (zero), process the
input parameters. Otherwise, skip these steps and go to Read and Compile the SQL
Statement on page 10-25.
1. Get the length of the names buffer (for parameter names) from the
input_names_len field in the SQLSA structure.
2. Allocate memory for the input SQLDA (and names buffer, if needed). Example 10-4
on page 10-30 uses the function named allocate_sqlda to perform this step.
3. Initialize the SQLDA header fields (SQLDA_EYE_CATCHER is defined by the
C compiler):
*input_sqlda_ptr.eye_catcher = SQLDA_EYE_CATCHER;
*input_sqlda_ptr.num_entries = sqlsa.u.prepare.input_num;
4. Specify a DESCRIBE INPUT statement to access input parameters:
EXEC SQL DESCRIBE INPUT :statement_name
INTO :*input_sqlda_ptr
NAMES INTO :*input_namesbuf_ptr;
5. Loop through the sqlvar in the input SQLDA structure. Loop n times, where n is
the number of parameters from the input_num field. On each iteration of the loop:

Table of Contents

Related product manuals