Determining the cause of an exception in SQLSTATE

To determine the cause of an exception in SQLSTATE, use the GET DIAGNOSTICS statement.

About this task

To determine the cause of an exception in SQLSTATE:

Procedure

  1. Use GET DIAGNOSTICS to obtain the statement information such as the number of exceptions that the database server has generated.
  2. For each exception, use the EXCEPTION clause of GET DIAGNOSTICS to obtain detailed information about the exception.