Introduction:
This document explains why an SQL Error from a Native Stored Procedure may not be displayed when the EXIT HANDLER FOR SQLEXCEPTION clause is used.
Question:
Why wasn't the SQL Error from my Native Stored Procedure displayed on the SQL ERROR Summary Display? I used the EXIT HANDLER FOR SQLEXCEPTION clause in my SP.
Environment:
z/OS 1.11 and above.
Answer:
When DECLARE EXIT HANDLER FOR SQLEXCEPTION is used, the handler gets control when an SQL error occurs and clears the error code. Afterwards, when Detector regains control at the end of the SQL process, there is no SQL error to be reported.