TRY ... EXCEPT |
Top Previous Next |
Creates a block of statements and when an exception occurs during execution, the block is stopped from executing and the statements in the EXCEPT part are executed.
Syntax <try_except_block> ::= TRY [<compound_statement>] EXCEPT [<compound_statement>] END
<compound_statement> ::= {<block> | <statement>}
When an exception occurs between TRY and EXCEPT, executing that list of statement is stopped and the statements in the EXCEPT clause will be executed.
If no exception occurs between TRY and EXCEPT, all statements will be executed and the statements in the EXCEPT clause are ignored.
In the EXCEPT clause, the library functions from the Exception namespace can be used to retrieve additional information about the exception.
See Also
Example execute udsblock() returns(v1 integer, v2 integer) AS begin try v1 = 10; v2 = 10; try exception TEST_EXCEPTION; /* force an exception to occur */ v2 = 11; /* not executed, because an exception occured */ finally /* FINALLY block will be executed despite exception */ v2 = 14; end except /* exception handler will be executed because of the exception */ v1 = 14; end /* normal execution resumes as the exception was caught */ end |