Toad World® Forums

Breakpoints on Triggers for debugging

Hi I am using Toad 13.1.0.78 and I have managed to put a break point on one of my triggers. I have activated the toggle compiling with debug and have placed a breakpoint right on the begin. My question is how do i initiate to step through this through a DML command like an update statement. It seems that when I open a new SQL editior and create the update statement, it does not hit the breakpoint at all even though I know the trigger is processing and i verified this by using dbms_output stmnts.

Thanks,
John

Hello John,

It sounds like you're 90% of the way there. You'll need to wrap your DML statement in a "dummy" procedure to allow it to be compiled with debug info. This'll allow you start stepping into the code. I have also setup a trigger that fires after I insert into my orders table.

I set a breakpoint on line 3 and click "Execute PL/SQL with debugger".
image

Next, clicking "Step into" will open and move into my trigger's code where I can continue debugging.
image

Let me know if you have any issues. It sounds like you've got everything setup other than the initial "dummy" procedure.

Mike

Mike, thanks for the quick reply... I have done that already and I set a brekpoint on my UPDATE statement. Once I hit execute PL/SQL with debugger, it prompts me to the Set Parameters and execute, being I have no parameters, I hit execute and it never reaches or stops at the breakpoint. It does the update and toad just prompts a message indicating execution has terminated.
image

My update ion the trigger is right at the beginning

Can you confirm that the procedure is being compiled with debug correctly? You can quickly look in the Schema Browser on the left hand side to see what icon you've got. If the Schema Browser is already open I'd recommand refreshing the LHS as well just to grab the last state.
image

Seems although it compiled.. it is not allowing me to compile it with debug privileges.

You'll want to make sure you have the following privileges to use the DBMS debugger. I suspect you're missing the DEBUG ANY PROCEDURE though.
DEBUG CONNECT SESSION
DEBUG ANY PROCEDURE
EXECUTE ON DBMS_DEBUG

I have asked the dba to grant this for me. In the meantime they have given me an account to use that has the debug with compile and it is now able to hit my initial breakpoint. Is there a play button so that it can continue to execute until the next breakpoint?

Clicking the "Execute PL/SQL with debugger" again will continue to your next breakpoint or if no other breakpoints are found it'll continue until execution has finished.

Thank you. I'm assuming also in order to hit the break point in the trigger itself, you also need to have debug privileges on the table. If not then the break point will never be reached.