MySQL Forums
Forum List  »  Stored Procedures

Debugging stored procedures (simple tip)
Posted by: Lawrence Holtsclaw
Date: October 04, 2005 08:53AM

I haven't seen anyone mention this so...

Since errors received during execution of procedures can be misleading (and there's no debugger), I've found creating a MyISAM table like "CREATE TABLE foo (bar VARCHAR(512));" then sprinkling the procedure code with statements like "INSERT INTO foo VALUES (CONCAT('Got var=',var));" to be very helpful. Just truncating the table before the next run and then performing a "SELECT * FROM foo;" gets your messages in the order they were added. Plus, being a MyISAM table means an error does not reverse the messages you stuffed in there.

Hope this helps someone.

Options: ReplyQuote


Subject
Views
Written By
Posted
Debugging stored procedures (simple tip)
4492
October 04, 2005 08:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.