<< TRY ... EXCEPT | IBEBlock | Default values and comments >>

EXCEPTION

The EXCEPTION statement is similar to Firebird dynamic exceptions.

Syntax

     EXCEPTION <exception_name> [<exception_text>]

<exception_name> is the name of an exception which may be tested using the ibec_err_Name function.

Example

     execute ibeblock (divisor double precision)
     as
     begin
       i = 1;
       try
         if ((divisor is null) or (divisor = 0)) then
           exception INVALID_DIVISOR 'The divisor is invalid: NULL or 0';
         i = i/divisor;  
       except
         if (ibec_err_name() = 'INVALID_DIVISOR') then
           i = 0;
         else
           raise;
       end
     end

See also:
TRY ... FINALLY
TRY ... EXCEPT
Exception-handling Functions

back to top of page
<< TRY ... EXCEPT | IBEBlock | Default values and comments >>