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
ix
13. Exception Handling and Error Conditions
13. Exception Handling and Error Conditions
Checking the SQLSTATE Variable 13-1
Declaring SQLSTATE 13-1
SQL:1999 SQLSTATE Values 13-2
SQL/MX SQLSTATE Values 13-3
Using SQLSTATE 13-4
Checking the SQLCODE Variable 13-5
Declaring SQLCODE 13-5
Declaring SQLCODE and SQLSTATE 13-5
SQLCODE Values 13-6
Using SQLCODE 13-6
SQL/MX Exception Condition Messages 13-7
Viewing the SQL Messages 13-7
Accessing SQL Messages Within a Program 13-8
Using the WHENEVER Statement 13-8
Precedence of Multiple WHENEVER Declarations 13-9
Determining the Scope of a WHENEVER Declaration 13-9
Enabling and Disabling the WHENEVER Declaration 13-10
Saving and Restoring SQLSTATE or SQLCODE 13-10
Declaring SQLSTATE or SQLCODE in an Error Routine 13-12
Accessing and Using the Diagnostics Area 13-13
Using the GET DIAGNOSTICS Statement 13-13
Getting Statement and Condition Items 13-14
Special SQL/MX Error Conditions 13-15
Lost Open Error (8574) 13-15
Occurrences of the Lost Open Error 13-16
Recovering From the Lost Open Error 13-16
14. Transaction Management
Transaction Control Statements 14-1
Steps for Ensuring Data Consistency 14-1
Declaring Required Variables 14-3
Setting Attributes for Transactions 14-3
Starting a Transaction 14-6
Processing Database Changes 14-7
Testing for Errors 14-7
Committing Database Changes if No Errors Occur 14-8
Undoing Database Changes if an Error Occurs 14-8