Checking the execution of SQL statements

After executing an SQL statement, your program should check for any errors codes before you commit the data and handle the errors that they represent.

About this task

You can check the execution of SQL statements in one of the following ways:

  • By displaying specific fields in the SQLCA.
  • By testing SQLCODE or SQLSTATE for specific values.
  • By using the WHENEVER statement in your application program.
  • By testing indicator variables to detect numeric errors.
  • By using the GET DIAGNOSTICS statement in your application program to return all the condition information that results from the execution of an SQL statement.
  • By calling DSNTIAR to display the contents of the SQLCA.