Wednesday, December 29, 2010

Debug SQL Stored Procedure

In general, any database stored procedure can be debugged by inserting printouts within the procedure.  First, create a debug table to store the printouts.  e.g.

your_debug_table {
    id [int]
    message [string]
    timestamp [datetime]
}

Then, in your stored procedure, print messages to debug table.  e.g.

your_stored_procedure {
    ...
    insert into your_debug_table (message) values (your_message);
    ...
}

Keywords: MySQL, Oracle, PostgreSQL, MS SQL Server, Stored Procedure, Debug


   

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.