Effect of Signals on Handlers, Cursors, and Statements


Signals have different effects on statement execution depending on the signal class. The class determines how severe an error is. MariaDB ignores the value of the sql_mode system variable; in particular, strict SQL mode does not matter. MariaDB also ignores IGNORE: The intent of SIGNAL is to raise a user-generated error explicitly, so a signal is never ignored.

In the following descriptions, "unhandled" means that no handler for the signaled SQLSTATE value has been defined with DECLARE ... HANDLER.

Example:

mysql> delimiter //
mysql> CREATE FUNCTION f () RETURNS INT
 -> BEGIN
 -> SIGNAL SQLSTATE '01234'; -- signal a warning
 -> RETURN 5;
 -> END//
mysql> delimiter ;
mysql> CREATE TABLE t (s1 INT);
mysql> INSERT INTO t VALUES (f());

The result is that a row containing 5 is inserted into table t. The warning that is signaled can be viewed with SHOW WARNINGS.

Retornar