There is a standard way of trapping any SQL or database errors in
Pro*C.This is done using
EXEC SQL WHENEVER SQLERROR DO
just ensure that the above statement goes before any sql
statements
whenever an error is encountered , the control goes to the function
function_name
in the body of the function_name , just add a statement along with
other error handling statements, that is
EXEC SQL WHENEVER SQLERROR CONTINUE;
this would prevent the error handler from going into recursion
and finally an infinite loop.