Errors and warnings in procedures
258
Error handling with ON EXCEPTION RESUME
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.
Note
When a statement has several parts or clauses, such as IF, ELSE IF, END
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.
Drop the procedures
Remember to drop both the
InnerProc
and
OuterProc
procedures before
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
OuterProc
; and
OuterProc
in turn calls the
procedure
InnerProc
, which then encounters an error. These demonstration
procedures are based on those used earlier in this section:
Summary of Contents for Adaptive Server IQ 12.4.2
Page 1: ...Administration and Performance Guide Adaptive Server IQ 12 4 2 ...
Page 16: ...xvi ...
Page 20: ...Related documents xx ...
Page 40: ...Compatibility with earlier versions 20 ...
Page 118: ...Troubleshooting startup shutdown and connections 98 ...
Page 248: ...Importing data by replication 228 ...
Page 306: ...Integrity rules in the system tables 286 ...
Page 334: ...Cursors in transactions 314 ...
Page 396: ...Users and permissions in the system tables 376 ...
Page 438: ...Determining your data backup and recovery strategy 418 ...
Page 484: ...Network performance 464 ...
Page 500: ...System utilities to monitor CPU use 480 ...
Page 514: ...Characteristics of Open Client and jConnect connections 494 ...
Page 536: ...Index 516 ...