Whenever related Query!
Posted in 1999
Topics: Error Codes & Troubleshooting
Hi , The whenever error call func_x() statement calls func_x() whenever a negative sqlcode error occurs. I have a situation where a database remote connection fails after a certain period of time. The next open statement fails and this returns a -936 sql error. Q.Why did the whenever error function not call func_x(). This was a negative error???? Raymond
PINTOR@valuerx.com wrote: > The whenever error call func_x() statement calls func_x() whenever a > negative sqlcode error occurs. > > I have a situation where a database remote connection fails after > a certain period of time. The next open statement fails and this > returns a -936 sql error. > > Q.Why did the whenever error function not call func_x(). This was a > negative error???? Most probably because the function where the OPEN fails does not have WHENEVER ERROR CALL func_x in effect. The WHENEVER statement looks like an executable statement, and can only be placed where executable statements can appear, but it is nevertheless a compiler directive. Consequently, unless your code definitely includes the WHENEVER ERROR CALL func_x before the OPEN, it will not not call the error function. Also, most SQL statements can fail for odd reasons such as this, so most SQL statements should be protected with WHENEVER ERROR CONTINUE before the statement, and a WHENEVER ERROR STOP (or CALL func_x) after the statement, with some error detecting code in the program. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>