Re: Stored Procedure Qn
Posted in 1995
Gururaj (gururaj@PROBLEM_WITH_INEWS_GATEWAY_FILE) wrote: : Hi Informix users, : : I am working on INFORMIX 5.03 Online version on HP-UX. : I am encountering the following problem when executing a stored : procedure from a ESQL/C program. : The stored proc is like this: : ------------------------------------------------- : CREATE PROCEDURE xxx; : ON EXCEPTION SET esql, eisam, estr; : call log_the_error_function; : END EXCEPTION : -- code to check some values and insert some rows; : END PROCEDURE ; : ------------------------------------------------- : My esql/c program: : executes the stored proc xxx after which it checks for the status : value in sqlca.sqlcode. : ------------------------------------------------- : : What is happening is the stored procedure is : returning error -271 and ISAM error 143 for deadlock detection : which gets logged by the log_the_error_function : but : my esql/c program is not able to capture this error. : Is sqlca.sqlcode not set after EXECUTE PROCEDURE call? : If so what should I look for to capture this error? The ON EXCEPTION clause is trapping the error as you requested, so when the stored procedure returns control to the calling program the error condition is reset. If you really want to set sqlca.sqlcode upon returning to the calling program after trapping the error, you must issue a RAISE EXCEPTION command after your call to the error logging function in the ON EXCEPTION clause. : Any help in this regard will be appreciated. : Thanks, : Gururaj : ----------------------------------------------------------- : Gururaj P Ramarao e-mail: gururaj@gtetel.com : 1924I, Johnson Ferry Road, Phone : (404)648-7224 W : Atlanta GA 30319 (770)458-3037 H : ----------------------------------------------------------- -- ___ ___ Principal Consultant / ) __ . __/ /_ ) _ _ __ Informix Software Inc. (303) 850-0210 _/__/ (_(_ (/ / (_(_ _/__) (-' ~/ '(_- 5299 DTC Blvd #740 Englewood CO 80111 dberg@informix.com Opinions expressed herein are my own. Eventually all things merge into one...and a river runs through it. -N.Maclean