SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Contents
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
vii
9. Dynamic SQL
9. Dynamic SQL
Statements for Dynamic SQL With Arguments 9-2
Input Parameters and Output Variables 9-2
Floating-Point Variables 9-2
Steps for Using Dynamic SQL With Argument Lists 9-3
Declare a Host Variable for the Dynamic SQL Statement 9-4
Move the Statement Into the Host Variable 9-5
Prepare the SQL Statement 9-5
Set Explicit Input Values 9-6
Execute the Prepared Statement 9-6
Deallocate the Prepared Statement 9-7
Using EXECUTE IMMEDIATE 9-7
Setting Default Values Dynamically 9-8
10. Dynamic SQL With Descriptor Areas
Statements for Dynamic SQL With Descriptors 10-1
SQL Descriptor Areas 10-2
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