content_image/753079.jpg
## RESIGNAL Requires Condition Handler Context 

DA 1. (condition 2) ERROR 1051 (42S02): Unknown table ’xx’ (condition 1) ERROR 5 (45000) Unknown table ’xx’ 

The result of CALL p()  and SHOW ERRORS  for this example is: 

mysql> CALL p(); ERROR 5 (45000): Unknown table ’xx’ mysql> SHOW ERRORS; 

<img src='content_image/753079.jpg'>

All forms of RESIGNAL  require that the current context be a condition handler. Otherwise, RESIGNAL  is illegal and a RESIGNAL when handler not active  error occurs. For example: 

mysql> CREATE PROCEDURE p () RESIGNAL; Query OK, 0 rows affected (0.00 sec) 

mysql> CALL p(); ERROR 1645 (0K000): RESIGNAL when handler not active 

Here is a more difficult example: 

delimiter // CREATE FUNCTION f () RETURNS INT BEGIN RESIGNAL; RETURN 5; END// CREATE PROCEDURE p () BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION SET @a=f(); SIGNAL SQLSTATE ’55555’; END// delimiter ; CALL p(); 

RESIGNAL  occurs within the stored function f() . Although f()  itself is invoked within the context of the EXIT  handler, execution within f()  has its own context, which is not handler context. Thus, RESIGNAL within f()  results in a “handler not active”  error. 

## 13.6.7.5 SIGNAL Statement 

SIGNAL condition_value [SET signal_information_item [, signal_information_item ] ...] condition_value : { SQLSTATE [VALUE] sqlstate_value | condition_name } signal_information_item : condition_information_item_name  = simple_value_specification condition_information_item_name : { CLASS_ORIGIN | SUBCLASS_ORIGIN | MESSAGE_TEXT 

