SQL/MX 3.2.1 Programming Manual for C and COBOL (H06.26+, J06.15+)

Contents
HP NonStop SQL/MX Release 3.2.1 Programming Manual for C and COBOL—663854-005
vii
11. Dynamic SQL Cursors
SQL Item Descriptors 10-2
Allocating an SQL Descriptor Area 10-3
Deallocating an SQL Descriptor Area 10-3
Input Parameters 10-3
Describing Input Parameters 10-4
Setting the Data Values of Input Parameters 10-4
Setting Input Parameter Information Without DESCRIBE INPUT 10-6
Output Variables 10-7
Describing Output Variables 10-7
Getting the Values of Output Variables 10-7
Consideration—Retrieving Multiple Values From a Large Buffer 10-8
Steps for Using SQL Item Descriptor Areas 10-12
Declare a Host Variable for the Dynamic SQL Statement 10-14
Construct the SQL Statement From User Input 10-14
Allocate Input and Output SQL Descriptor Areas 10-14
Prepare the SQL Statement 10-15
Describe the Input Parameters and the Output Variables 10-15
Set Explicit Input Values 10-16
Execute the Prepared Statement 10-18
Get the Count and Descriptions of the Output Variables 10-19
Deallocate the Prepared Statement and the SQL Descriptor Areas 10-20
Using SQL Descriptor Areas to Select SQL/MP KANJI and KSC5601 Data 10-21
Using SQL Descriptor Areas to Retrieve ISO88591 Data to UCS2 Host
Variables 10-21
11. Dynamic SQL Cursors
Statements for Dynamic SQL Cursors 11-1
Steps for Using a Dynamic SQL Cursor
11-2
Declare Required Host Variables 11-4
Prepare the Cursor Specification 11-4
Declare the Cursor
11-4
Initialize the Dynamic Input Parameters
11-5
Open the Cursor 11-5
Retrieve the Values
11-5
Process the Retrieved Values
11-6
Fetch the Next Row
11-6
Close the Cursor and Deallocate the Prepared Statement
11-6
Using Date-Time and INTERVAL Data Types 11-7
Standard Date-Time Example
11-7