Stored Procedure Exceptions

From InterBase
Jump to: navigation, search

Go Up to Working with Stored Procedures


An exception is a named error message that can be raised from a stored procedure. Exceptions are created with CREATE EXCEPTION, modified with ALTER EXCEPTION, and dropped with DROP EXCEPTION. A stored procedure raises an exception with EXCEPTION <name>.

When raised, an exception returns an error message to the calling program and terminates execution of the procedure that raised it, unless the exception is handled by a WHEN statement.

Important: Like procedures, exceptions are created and stored in a database, where they can be used by any procedure that needs them. Exceptions must be created and committed before they can be raised.

For more information on raising and handling exceptions, see Raising an Exception in a Stored Procedure.

Topics