How to get rid of “Error 1329: No data - zero rows fetched, selected, or processed”

后端 未结 7 1600
心在旅途
心在旅途 2020-12-01 13:51

I have a stored procedure which does not need to return any values. It runs smoothly and without any problem. However, it outputs an error message after finishing its run:

相关标签:
7条回答
  • 2020-12-01 14:32

    I guess you just forgot to include the following line in your post:

    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
    

    Your code is correct, but bug/strange behaviour of mysql causes the warning to appear even if it was handled. You can avoid that if you add a "dummy" statement to the end of your procedure that invovles a table and is successful, this will clear the warning. (See http://dev.mysql.com/doc/refman/5.5/en/show-warnings.html) In your case:

    SELECT name INTO l_name FROM customer_tbl LIMIT 1;
    

    after the end of the loop. On MySQL 5.5.13 the warning disappears, on Linux and Windows. I commented on MySQL Bug 60840 and I hope they will fix it some time in the future...

    0 讨论(0)
提交回复
热议问题