EXCEPTION
From InterBase
Go Up to Procedures and Triggers
Raises the specified exception. Available in triggers and stored procedures.
EXCEPTION name;
Argument | Description |
---|---|
<name> |
Name of the exception being raised |
Description: An exception is a user-defined error that has a name and an associated text message. When raised, an exception:
- Terminates the procedure or trigger in which it was raised and undoes any actions performed (directly or indirectly) by the procedure or trigger.
- Returns an error message to the calling application. In
isql
, the error message is displayed to the screen.
Exceptions can be handled with the WHEN
statement. If an exception is handled, it will behave differently.
Example: The following isql
statement defines an exception named REASSIGN_SALES
:
CREATE EXCEPTION REASSIGN_SALES
'Reassign the sales records before deleting this employee.' ;
Then these statements from a procedure body raise the exception:
IF (ANY_SALES > 0) THEN
EXCEPTION REASSIGN_SALES;
See Also
For more information on creating exceptions, see CREATE EXCEPTION.