statement_SIGNAL ::= SIGNAL exception identifier;
The SIGNAL statement raises a user defined exception. The exception has to be declared previously. If a handler is declared for this exception, it will be executed and the statement execution will continue according to the handler type and position.
If no handler is found for the specified exception, the error sqlstate 45000 (SQ_UNHANDLED_USER_EXCEPT) occurs .
Usage example:
PROCEDURE `TRY_SIGNAL`(); BEGIN DECLARE jump CONDITION; DECLARE CONTINUE HANDLER FOR jump BEGIN CALL log_write("NULL - inside the continue handler"); ... END; FOR row AS c INSENSITIVE CURSOR FOR SELECT * FROM Companies DO BEGIN IF row.address IS NULL THEN SIGNAL jump; ELSE ... CALL log_write(row.address); END IF; END; END FOR; END
See