| United States-English |
|
|
|
![]() |
ALLBASE/SQL Advanced Application Programming Guide: HP 3000 MPE/iX Computer Systems > Chapter 5 Using Procedures in Application ProgramsTesting SQLCODE and SQLWARN0 on Return from a Procedure |
|
Upon return from an EXECUTE PROCEDURE call, the value of SQLCODE indicates the success of procedure execution itself, not of any individual statement in the procedure. After returning from an EXECUTE PROCEDURE statement, your application should test SQLCODE to determine if the proceedure was successful and SQLWARN0 for possible errors, warnings, and informational messages. A non-zero SQLCODE is returned from procedure execution in the following situations:
In all other cases, SQLCODE is 0 on return from a procedure, including cases in which errors occurred in a procedure and did not cause the procedure to stop. Messages for any errors from the last SQL statement executed by the procedure are available on return from the procedure by testing SQLWARN0 for a value of 'W' and using SQLEXPLAIN. The following type of routine is recommended on return from an EXECUTE PROCEDURE statement in C:
The following is a similar routine in COBOL:
This routine tests both SQLCODE and SQLWARN0 for the presence of error conditions, warnings, and messages of all kinds, including those generated by PRINT and RAISE ERROR statements and resulting from PRINTRULES being set on. |
|||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||