Apply Auto Debugger Adding Out of Scope Variable

This is the first time I have really played with the "Apply Auto Debugger" capability in TOAD. I always just manually added a few DBMS_OUTPUT commands here and there as needed, but this tool is really nice most of the time. I just started creating a new Package with several stubbed out Procedures/Functions. I started adding some code and something has confused the Apply Auto Debugger. Here is the Package Body without the Apply Auto Debugger statements:

IE_DATA_MAINT.sql (11.3 KB)

It compiles without issue, so I assume my syntax is correct for the stubs and portion I have coded. Here is the code with the Auto Debugging:

IE_DATA_MAINT Debugging.sql (19.4 KB)

This code will not compile because of lines 340-346 '{Toad_198259455_11}' which attempt to write out variables defined in the procedure immediately above. There is then a simple setting of a variable followed by '{Toad_198259455_12}' segment which correctly uses the variables in scope for the procedure. Initially I thought it was because the Procedure did not have any parameters associated, so I added a dummy param, did a Remove Debugging then Added it back and got the same result.

I just went to compile with the lines mentioned above removed and discovered the issue is more wide spread. Line 140 [4] and 219 [7] also include variables from the previous code block. It seems to be over zealous on the initial debugging segment in each Proc/Funct. I guess I did not initially see that as all blocks were just stubs and had the same dummy variables defined.

Thanks Michael. I've logged it.

Here's a little story about the Auto-debugger: You may remember several years ago when Bert Scalzo worked here. The Auto-debugger was his idea, and he helped develop it. We wanted to call it the "BS Debugger" but that idea didn't fly.

John,

Great story. I did find if I select a single Proc or Function in the Package and click the Apply Auto Debugger, it operates only on the selected code and only includes correctly scoped variables.

Now that I have discovered the Auto Debug buttons, I can't believe I spent so much time manually adding/changing/removing DBMS_OUTPUT.put_line statements in code. This capability has made code debugging so much quicker!!!

1 Like