MySQL stored procedure, handling multiple cursors and query results

前端 未结 5 1369

How can I use two cursors in the same routine? If I remove the second cursor declaration and fetch loop everthing works fine. The routine is used for adding a friend in my webap

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-14 08:38

    I know you found a better solution, but I believe the answer to your original question is that you need to SET Done=0; between the two cursors, otherwise the second cursor will only fetch one record before exiting the loop due to Done=1 from the previous handler.

提交回复
热议问题