Use the CALL clause to transfer program control to the specified UDR when the specified type of exception occurs. Do not include parentheses after the UDR name. The following WHENEVER statement causes the program to call the error_recovery() function if the program detects an error:
EXEC SQL WHENEVER SQLERROR CALL error_recovery;
When the UDR returns, execution resumes at the next statement after the line that is causing the error. If you want to halt execution when an error occurs, include statements that terminate the program as part of the specified UDR.
Observe the following restrictions on the specified routine:
Related statements: EXECUTE FUNCTION , EXECUTE PROCEDURE, and FETCH
For discussions on exception handling and error checking, see the IBM Informix ESQL/C Programmer's Manual.