Debugging Triggers in SQL Navigator 6.3

One of the regressions of SQL Navigator v6.0-6.2 compared to v5.5 was inability to debug triggers. The reason was that PL/SQL Debugger starting with v6.0 is incorporated into Code Editor, which doesn’t have the ability to edit triggers. To solve the problem, v6.3 introduces a new feature into Code Editor: Edit Body. This function allows the user to open and edit in Code Editor the body of a trigger, set breakpoints and therefore trace into it using the debugger. This feature is intermediate before introducing a full-featured Trigger Editor as part of Code Editor in a future version and is explained below.

How to open a trigger body in Code Editor

To open a trigger body, use the new Edit Body right-click menu option in DB Explorer:

This will create a new tab and load the trigger’s body in it: You can modify the body and save it to the database if you wish. To change other properties of the trigger, such as timing, use Trigger Editor like you did before (but you need to close the body in Code Editor first).

How to debug a trigger

To debug the body you just opened, you have to set a breakpoint/breakpoints first by clicking the gutter, like for other types of objects: To start debugging, you need to create either a PL/SQL block or a stored procedure performing the DML statement that fires the trigger:

Note: Remember to include a COMMIT or ROLLBACK statement to unlock the rows modified by the statement otherwise you may lock your object and cause SQL Navigator to freeze.

When the statement is executed, given that it fires the trigger correctly and PL/SQL Debugger is enabled, the execution will stop at the breakpoint: Now you can trace through the trigger logic normally using F8 (Step Over), F7 (Trace Into), set additional breakpoints and watch local variables: