As an alternative to using the GET DIAGNOSTICS statement in a handler to retrieve the SQLSTATE into an SQL variable, and for compatibility with other implementations, supply an SQLSTATE or SQLCODE local variable and code the following as the first statement in your handler:
SET SQL-variable-name = sqlstate-or-sqlcode;
SQL then assigns a value to your SQLSTATE or SQLCODE variable after every statement execution. Instructions for using this feature follows:
For example, from a functional point of view code example 1 (following on this page) and code example 2 (see Code Example 2) are equivalent. In the example that follows, logic that is not shown (for space considerations) is indicated by three vertically arranged periods.
|
Copyright © 2014 CA.
All rights reserved.
|
|