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

后端 未结 7 1677
心在旅途
心在旅途 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:26

    I ran into this and pulled out my hair till I ran across this in the official mysql docs

    Before MySQL 5.6.3, if a statement that generates a warning or error causes a condition handler to be invoked, the handler may not clear the diagnostic area. This might lead to the appearance that the handler was not invoked. The following discussion demonstrates the issue and provides a workaround.

    Click the link and scroll to the bottom for details but the fix was to include a successful select INSIDE the CONTINUE HANDLER:

    DECLARE CONTINUE HANDLER FOR NOT FOUND
    BEGIN
       SELECT 1 INTO @handler_invoked FROM (SELECT 1) AS t;
    END;
    

提交回复
热议问题