Raising an Exception in a Stored Procedure
From InterBase
To raise an exception in a stored procedure, use the following syntax:
EXCEPTION name;
where <name> is the name of an exception that already exists in the database.
When an exception is raised, it does the following:
- Terminates the procedure in which it was raised and undoes any actions performed (directly or indirectly) by the procedure.
- Returns an error message to the calling application. In isql, the error message is displayed on the screen.
- Note: If an exception is handled with a
WHEN
statement, it behaves differently. For more information on exception handling, see Handling Exceptions.
The following statements raise the exception, REASSIGN_SALES
:
IF (any_sales > 0) THEN EXCEPTION REASSIGN_SALES;