Copyright Ó Oracle Corporation, All rights reserved Debugging Triggers
14-2 Copyright Ó Oracle Corporation, All rights reserved. Objectives After completing this lesson, you should be able to do the following: Describe the components of the Debugger Run a form module in debug mode Debug PL/SQL code After completing this lesson, you should be able to do the following: Describe the components of the Debugger Run a form module in debug mode Debug PL/SQL code
14-3 Copyright Ó Oracle Corporation, All rights reserved. Debugging Triggers Monitor and debug triggers by: Compiling correct errors in the PL/SQL Editor Displaying debug messages at run time Invoking the PL/SQL Debugger Monitor and debug triggers by: Compiling correct errors in the PL/SQL Editor Displaying debug messages at run time Invoking the PL/SQL Debugger
14-4 Copyright Ó Oracle Corporation, All rights reserved. Debugging Tips Connect to the database for SQL compilation. The line that fails is not always responsible. Watch for missing semicolons and quotation marks. Define triggers at the correct level. Place triggers where the event will happen. Connect to the database for SQL compilation. The line that fails is not always responsible. Watch for missing semicolons and quotation marks. Define triggers at the correct level. Place triggers where the event will happen.
14-5 Copyright Ó Oracle Corporation, All rights reserved. Running a Form in Debug Mode Run Form Debug Contains source code and executable runfile.FMX (Compiles automatically) (Runs automatically) Run Form in Debug Mode
14-6 Copyright Ó Oracle Corporation, All rights reserved. PL/SQL Debugger
14-7 Copyright Ó Oracle Corporation, All rights reserved. PL/SQL Debugger
14-8 Copyright Ó Oracle Corporation, All rights reserved. Invoking the Debugger and Breakpoints DebugMode 1 2 FormStartup
14-9 Copyright Ó Oracle Corporation, All rights reserved. Breakpoint and Debug Triggers EveryStatement Debugger Program Unit Statement Debug trigger Breakpoint trigger Fire Breakpoint
14-10 Copyright Ó Oracle Corporation, All rights reserved. Debug Triggers
14-11 Copyright Ó Oracle Corporation, All rights reserved. Debug Commands Step over Stepout Reset GO 1 2 Stepinto
14-12 Copyright Ó Oracle Corporation, All rights reserved. Debug Example …calls... The results are: ?? WHEN-BUTTON-DEPRESSED 1 Procedure XYZ; Function ABC;
14-13 Copyright Ó Oracle Corporation, All rights reserved. Debugger: Setting a Breakpoint
14-14 Copyright Ó Oracle Corporation, All rights reserved. Debugger: Stepping into Code
14-15 Copyright Ó Oracle Corporation, All rights reserved. Debugger: Checking Variables
14-16 Copyright Ó Oracle Corporation, All rights reserved. Corrected Code FUNCTION abc (abc_param IN NUMBER) RETURN NUMBER IS v_total NUMBER := 0; v_num3 NUMBER := 3; v_num6 NUMBER := 6; /*-- changed value to 6 */ BEGIN v_total := v_num3 * v_num6; v_total := v_total + abc_param; RETURN v_total; END abc; FUNCTION abc (abc_param IN NUMBER) RETURN NUMBER IS v_total NUMBER := 0; v_num3 NUMBER := 3; v_num6 NUMBER := 6; /*-- changed value to 6 */ BEGIN v_total := v_num3 * v_num6; v_total := v_total + abc_param; RETURN v_total; END abc;
14-17 Copyright Ó Oracle Corporation, All rights reserved. Summary To debug a form: Use the Run Form Debug button, and set breakpoints. Debug commands can be entered in the Interpreter pane or by using buttons. Set breakpoints to invoke the Debugger. Break and Debug triggers are available to program Debug Actions on events in the form. To debug a form: Use the Run Form Debug button, and set breakpoints. Debug commands can be entered in the Interpreter pane or by using buttons. Set breakpoints to invoke the Debugger. Break and Debug triggers are available to program Debug Actions on events in the form.
14-18 Copyright Ó Oracle Corporation, All rights reserved. Practice 14 Overview This practice covers using the Debugger to help solve problems at run time.