Subject Re: Debugging Stored Procedures
Author jrodenhi
Luc,
Thank you for your help.

--- In firebird-support@yahoogroups.com, Lucas Franzen <luc@...> wrote:
>
> Jack,
> Once you get acquainted with the syntax it's quite easy, thus debugging
> will be necessary only rarely.

Most of my experience is with MS SQL Server. I don't know if it
provides more feedback on syntax errors or if it is just lack of
experience on my part but getting past the syntax stage in Firebird
does seem to take a little time.

>
> Some DB-tools (DBWorkbench, IBExpert) offer a SP debugger but you
> shouldn't trust them always 100%.

Maybe I should try one of those. I'm skeptical about the emulation
arrangement, but for someone just getting started, it might be a good
idea.

> If you're stuck try to add some error handling (ie WHEN ANY...) and
> return kind of a loop variable to see at which stage the sp's not
> working correctly (given that the sp is compiled and you're not having
> troubles with the syntax).
> In extreme cases you might think about adding a table to your database
> where a sp might write its current state and values into.

When I was searching this newsgroup for debugging messages, I saw that
someone was using a UDF to output debugging messages to a log file.
It does seem like finding a way to return the messages is part of the
trick.

> Use the colon whenever it's part of an SQL statement or when used to
> select into, never in the other cases.

This and what follows in your message are very helpful. Thank
you for a concise explanation with very useful examples.

-Jack