Condition Handling SET @error_count = @error_count + 1; IF @a = 0 THEN RESIGNAL SET MYSQL_ERRNO = 5; END IF; END; DROP TABLE xx; END// delimiter ; SET @error_count = 0; SET @a = 0; CALL p(); DA 1. ERROR 1051 (42S02): Unknown table ’xx’ DA 1. ERROR 5 (42S02): Unknown table ’xx’ RESIGNAL  condition_value [SET  signal_information_item  [,  signal_information_item ] ...]; DROP TABLE IF EXISTS xx; delimiter // CREATE PROCEDURE p () BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN SET @error_count = @error_count + 1; IF @a = 0 THEN RESIGNAL SQLSTATE ’45000’ SET MYSQL_ERRNO=5; END IF; END; DROP TABLE xx; END// delimiter ; SET @error_count = 0; SET @a = 0; SET @@max_error_count = 2; CALL p(); SHOW ERRORS; 2820 The  RESIGNAL  statement includes a condition value ( SQLSTATE ’45000’ ), so it adds a new condition area, resulting in a diagnostics area stack that looks like this: This is similar to the previous example, and the effects are the same, except that if  RESIGNAL  happens, the current condition area looks different at the end. (The reason the condition adds to rather than replaces the existing condition is the use of a condition value.) Example: This form of  RESIGNAL  restores the last diagnostics area and makes it the current diagnostics area. That is, it “pops”  the diagnostics area stack, which is the same as what a simple  RESIGNAL  alone would do. However, it also changes the diagnostics area depending on the condition value or signal information. The  RESIGNAL  statement can change any or all of the signal information items, making the first condition area of the diagnostics area look quite different. In other words, it changes the error number, and nothing else. The  RESIGNAL SET MYSQL_ERRNO = 5  statement results in this stack instead, which is what the caller sees: RESIGNAL  with a condition value means “push a condition into the current diagnostics area.”  If the  SET clause is present, it also changes the error information. RESIGNAL with a Condition Value and Optional New Signal Information Remember from the previous discussion that  RESIGNAL  alone results in a diagnostics area stack like this: