Sample Header Ad - 728x90

Logical condition when declaring handler procedure

2 votes
1 answer
586 views
I have a procedure in MySQL that executes a handler for SQLEXCEPTION to read the errno code and insert it to a table. DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; I'm expecting something like this DECLARE EXIT HANDLER FOR SQLEXCEPTION OR SQLWARNING BEGIN GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; Is there a chance to use OR or AND logical operators in sql handler? Or, can I get some advice to get the WARNING and ERROR messages in one DECLARE line?
Asked by tachomi (313 rep)
May 18, 2016, 10:06 PM
Last activity: May 25, 2016, 05:22 PM