Error Handling With On Exception Resume - Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual

Table of Contents

Advertisement

Errors and warnings in procedures

Error handling with ON EXCEPTION RESUME

Drop the procedures
258
If the ON EXCEPTION RESUME clause is included in the CREATE
PROCEDURE statement, the procedure checks the following statement when
an error occurs. If the statement handles the error, then the procedure does not
return control to the calling environment when an error occurs. Instead, it
continues executing, resuming at the statement after the one causing the error.
When a statement has several parts or clauses, such as IF, ELSE IF, END
Note
IF, or FOR and END FOR, the "following statement" refers to the next new
statement, not a statement part.
The following statements are considered error-handling statements:
IF
SELECT @variable =
CASE
LOOP
LEAVE
CONTINUE
CALL
EXECUTE
SIGNAL
RESIGNAL
DECLARE
The following example illustrates how this works.
Remember to drop both the
continuing with the tutorial. You can do this by entering the following
commands in the command window:
DROP PROCEDURE OUTERPROC;
DROP PROCEDURE INNERPROC
The following demonstration procedures show what happens when an
application calls the procedure
procedure
, which then encounters an error. These demonstration
InnerProc
procedures are based on those used earlier in this section:
and
InnerProc
OuterProc
; and
OuterProc
OuterProc
procedures before
in turn calls the

Advertisement

Table of Contents
loading

Table of Contents