How do you debug MySQL stored procedures?

后端 未结 16 1270
旧时难觅i
旧时难觅i 2020-11-30 17:44

My current process for debugging stored procedures is very simple. I create a table called \"debug\" where I insert variable values from the stored procedure as it runs. Thi

16条回答
  •  星月不相逢
    2020-11-30 18:10

    I do something very similar to you.

    I'll usually include a DEBUG param that defaults to false and I can set to true at run time. Then wrap the debug statements into an "If DEBUG" block.

    I also use a logging table with many of my jobs so that I can review processes and timing. My Debug code gets output there as well. I include the calling param name, a brief description, row counts affected (if appropriate), a comments field and a time stamp.

    Good debugging tools is one of the sad failings of all SQL platforms.

提交回复
热议问题