1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
------------------
Exception handling
------------------
The common syntax rules for EXCEPTION statement is:
EXCEPTION [[name] [value]];
Run-time exception messages (FB 1.5)
------------------------------------
Function:
Allows to throw exceptions with text message
defined at runtime.
Author:
Dmitry Yemanov <yemanov@yandex.ru>
Syntax rules:
EXCEPTION <exception_name> <message_value>;
Scope:
PSQL
Example(s):
1. EXCEPTION E_EXCEPTION_1 'Error!';
2. EXCEPTION E_EXCEPTION_2 'Wrong type for record with ID=' || new.ID;
Exception re-raise semantics (FB 1.5)
-------------------------------------
Function:
Allows to re-initiate catched exception.
Author:
Digitman <digitman@hotbox.ru>
Syntax rules:
EXCEPTION;
Scope:
PSQL, context of the exception handling block
Example(s):
BEGIN
...
WHEN SQLCODE -802 THEN
EXCEPTION E_ARITH_EXCEPT;
WHEN SQLCODE -802 THEN
EXCEPTION E_KEY_VIOLATION;
WHEN ANY THEN
EXCEPTION;
END
Note(s):
Evaluates to no-op if used outside the exception handling block.
Run-time error codes (FB 1.5)
-----------------------------
Function:
Allows to get a numeric error code for the catched exception.
Author:
Dmitry Yemanov <yemanov@yandex.ru>
Syntax rules:
SQLCODE / GDSCODE;
Scope:
PSQL, context of the exception handling block
See also:
README.context_variables
|