Description\n-----------\n\nSyntax\n\n``sql\nSIGNAL error_condition\n    [SET error_property\n    [, error_property] ...]\n\nerror_condition:\n    SQLSTATE [VALUE] 'sqlstate_value'\n  | condition_name\n\nerror_property:\n    error_property_name = <error_property_value>\n\nerror_property_name:\n    CLASS_ORIGIN\n  | SUBCLASS_ORIGIN\n  | MESSAGE_TEXT\n  | MYSQL_ERRNO\n  | CONSTRAINT_CATALOG\n  | CONSTRAINT_SCHEMA\n  | CONSTRAINT_NAME\n  | CATALOG_NAME\n  | SCHEMA_NAME\n  | TABLE_NAME\n  | COLUMN_NAME\n  | CURSOR_NAME\n`\n\nSIGNAL empties the diagnostics area and produces a custom error. This statement can be used anywhere but is generally useful when used inside a stored program. When the error is produced, it can be caught by a HANDLER. If not, the current stored program, or the current statement, will terminate with the specified error.\n\nSometimes an error HANDLER just needs to SIGNAL the same error it received, optionally with some changes. Usually, the RESIGNAL statement is the most convenient way to do this.\n\nerror_condition can be an SQLSTATE value, or a named error condition defined via DECLARE CONDITION. SQLSTATE must be a constant string consisting of five characters. These codes are standard to ODBC and ANSI SQL. For customized errors, the recommended SQLSTATE is '45000'. For a list of SQLSTATE values used by MariaDB, see the MariaDB Error Codes page. The SQLSTATE can be read via the API method mysql_sqlstate( ).\n\nTo specify error properties user-defined variables and local variables can be used, as well as character set conversions (but you can't set a collation).\n\nThe error properties, their type and their default values are explained in the diagnostics area page.\n\nErrors\n\nIf the SQLSTATE is not valid, the following error like this will be produced:\n\n`sql\nERROR 1407 (42000): Bad SQLSTATE: '123456'\n`\n\nIf a property is specified more than once, an error like this will be produced:\n\n`sql\nERROR 1641 (42000): Duplicate condition information item 'MESSAGE_TEXT'\n`\n\nIf you specify a condition name which is not declared, an error like this will be produced:\n\n`sql\nERROR 1319 (42000): Undefined CONDITION: cond_name\n`\n\nIf MYSQL_ERRNO is out of range, you will get an error like this:\n\n`sql\nERROR 1231 (42000): Variable 'MYSQL_ERRNO' can't be set to the value of '0'\n``\n\nExamples\n--------\n\nSIGNAL SQLSTATE '01000';\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n\n+---------+------+------------------------------------------+\n| Level   | Code | Message                                  |\n+---------+------+------------------------------------------+\n| Warning | 1642 | Unhandled user-defined warning condition |\n+---------+------+------------------------------------------+\n1 row in set (0.06 sec)\n\nSIGNAL SQLSTATE '02000';\nERROR 1643 (02000): Unhandled user-defined not found condition\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/signal