Toad World® Forums

Debugging: step in to exception code (Break on Exception)

Hello guys!

I am facing the following situation:

I Have to debug a function which calls a lot of other functions which are exception based, heavily relying on the NO_DATA_FOUND to search somewhere else.

My function is about 300 lines of code but it takes like 700 clicks on “Trace Out” because every 2-3 lines the debugger jumps into an exception which may be deep down the callstack.

All of these are handled, no unhandled exception might occurr which could (and then should) crash the execution.

Is there any solution for this nuisance? I saw some older threads and topics from 2009 to 2011 but none of them gave a solution for this, they just covered the “Break on Exception” menu check box

which I have disabled anyway.

Thanks in advance,

best regards

Kuvick1337

The issue you’re seeing is a “feature” of the DBMS Debugger. In an IDE like you would use for debugging C# or Java, the IDE itself keeps track of where exactly the execution code is. In Oracle, all of that information comes from the DB itself, not Toad. Every time you click on step in/over/out, Toad has to ask Oracle which line to go to next (you can see this if you click Database-> Spool SQL). What unchecking the “break on exception” does is prevent you from being prompted with the exception message that you would normally see. Since your code is actually going into the exception, it’s still an executable line of code and that’s why Oracle sends you there. Simply put, there isn’t any check/feature/option you can set to stop what you’re seeing.

Greg (formerly the debugger guy)

From: Kuvick1337 [mailto:bounce-Kuvick1337@toadworld.com]

Sent: Tuesday, March 29, 2016 7:06 AM

To: toadoracle@toadworld.com

Subject: [Toad for Oracle - Discussion Forum] Debugging: step in to exception code (Break on Exception)

Debugging: step in to exception code (Break on Exception)

Thread created by Kuvick1337

Hello guys!

I am facing the following situation:

I Have to debug a function which calls a lot of other functions which are exception based, heavily relying on the NO_DATA_FOUND to search somewhere else.

My function is about 300 lines of code but it takes like 700 clicks on “Trace Out” because every 2-3 lines the debugger jumps into an exception which may be deep down the callstack.

All of these are handled, no unhandled exception might occurr which could (and then should) crash the execution.

Is there any solution for this nuisance? I saw some older threads and topics from 2009 to 2011 but none of them gave a solution for this, they just covered the “Break on Exception” menu check box

which I have disabled anyway.

Thanks in advance,

best regards

Kuvick1337

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.

Hello Gregory!

Thank you for your quick reply.

I guess I am quite spoiled by IntelliJ! :smiley:

Do you know anything about maybe enhacements to the Oracle DB or similar to enhance the debugging experience in PL/SQL?

greetings,

Kuvick

Kuvick,

There’s nothing on their roadmap. They’re no longer supporting the DBMS_DEBUG API and use the JDWP debugger in their current offerings. The issue is the same, even with the different technology. It’s simply because Oracle has to take into account the scope of what is happening in the DB at every step whereas IntelliJ can keep everything self contained within the scope of the java code.

One think you might want to try is to set some breakpoints at some key locations after your exceptions are called and do a run to breakpoint. It’s a little hokey but it might save you few hundred clicks.

From: Kuvick1337 [mailto:bounce-Kuvick1337@toadworld.com]

Sent: Tuesday, March 29, 2016 7:42 AM

To: toadoracle@toadworld.com

Subject: RE: [Toad for Oracle - Discussion Forum] Debugging: step in to exception code (Break on Exception)

RE: Debugging: step in to exception code (Break on Exception)

Reply by Kuvick1337

Hello Gregory!

Thank you for your quick reply.

I guess I am quite spoiled by IntelliJ! :smiley:

Do you know anything about maybe enhacements to the Oracle DB or similar to enhance the debugging experience in PL/SQL?

greetings,

Kuvick

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.

You can also use run to caret which may work well here.

Thanks for your suggestions guys! :slight_smile:

I already know the Run To Caret, but I haven’t seen the Run To Breakpoint . Is it a relatively new functuality? I am still on 12.7.1, so maybe that’s why I haven’t seen this one yet.

Unfortunately neither of these would have helped me because I needed to evaluate the state of some variables after each of these exception based functions.

Luckily I already fixed it, the Trace Out is my best friend now! :wink: