Error resolution Mysql-event Scheduler:no Data-zero rows fetched, selected, or processed

Source: Internet
Author: User

When a warning with not FOUND (no data) is encountered, a conditional handle containing a clear warning statement is used to process the program and exit the handle. This issue was resolved after the MySQL5.6.3 version, so the workaround is not necessary. Workaround:   
  DECLARE CONTINUE HANDLER for not FOUND    BEGIN
SET done=1 SELECT 1 to @handler_invoked from (SELECT 1) as T; END;
Source:Click the link (http://dev.mysql.com/doc/refman/5.5/en/condition-handling.html) and scroll to the bottom for details but T He fix is to include a successful select INSIDE the CONTINUE HANDLER: Original:

Before MySQL 5.6.3, if a statement that generates a warning or error causes a condition handler to be invoked, the handler May isn't clear the diagnostic area. This might leads to the appearance that the handler is not invoked. The following discussion demonstrates the issue and provides a workaround.

Suppose. A table is t1 empty. The following procedure selects from it, raising a No Data condition:

CREATE PROCEDURE p1 () BEGIN  DECLARE a INT;  DECLARE CONTINUE HANDLER for not FOUND    BEGIN      SET @handler_invoked = 1;    END;  SELECT C1 to a from T1; END;

As can be seen from the following sequence of statements, the condition are not cleared by handler invocation (otherwise, t He SHOW WARNINGS output would be empty). @handler_invokedBut as can is seen by the value of, the handler is indeed invoked (otherwise its value would is 0).

mysql>   SET @handler_invoked = 0;   Query OK, 0 rows Affected (0.00 sec) mysql>   call P1 ();   Query OK, 0 rows affected, 1 Warning (0.00 sec) mysql>   SHOW WARNINGS;   +---------+------+-----------------------------------------------------+| Level | Code | Message |+---------+------+--------------------------------------------------- --+| Warning | 1329 | No Data-zero rows fetched, selected, or processed |+---------+------+------------------------------------------------ -----+1 Row in Set (0.00 sec) mysql>   SELECT @handler_invoked;   +------------------+|                @handler_invoked |+------------------+| 1 |+------------------+1 row in Set (0.00 sec) 

To work around the issue, use a condition handler containing a statement that clears warnings:

CREATE PROCEDURE p1 () BEGIN  DECLARE a INT;  DECLARE CONTINUE HANDLER for not FOUND    BEGIN      SELECT 1 to @handler_invoked from (SELECT 1) as T;    END;  SELECT C1 to a from T1; END;

This works for CONTINUE and EXIT handlers.

This issue are resolved as of MySQL 5.6.3 and no workaround is needed.

Error resolution Mysql-event Scheduler:no Data-zero rows fetched, selected, or processed

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.