This example demonstrates how to debug an Oracle package using Oracle PL/SQL debugging tool built into dbForge Studio for Oracle. In this topic, sample database objects are created with the help of dbForge Studio for Oracle.
The example describes the following steps:
We will use the stored procedure created in Debugging a Stored Procedure.
For the demo, we create the PACKAGE_SCHEDULE package.
To create a package, do the following:
In the document that opens, copy and paste the following script:
-- PACKAGE_SCHEDULE specification
CREATE OR REPLACE PACKAGE SCHEDULE.Package_Schedule AS
PROCEDURE FILLSCHEDULE(DATE_FROM IN DATE, DATE_TO IN DATE,SCHEDULE_ID IN INT);
FUNCTION GetFirstDayOfMonth(DT DATE) RETURN DATE;
END Package_Schedule;
/
To debug Oracle packages, you should first compile them with debug information.
To compile the package for debugging, do the following:
In Database Explorer, right-click the package you want to compile, click Compile, and then select Compile Dependants for Debugging to load debugging information for the objects on which the selected object is dependent.
In the compiling window that opens, the object you want to compile is selected by default. Click Compile, and then click Close.
To debug an Oracle package, do the following:
To set a breakpoint for the package, right-click the line of the code and click Insert Breakpoint on the shortcut menu.
Note:
Keep in mind that the breakpoint can be set only on the executable code. To execute the package, select the code, right-click the code, and click Execute Current Statement or press F8.
If you want to remove the breakpoint you have set, right-click the breakpoint in the document and click Delete Breakpoint on the shortcut menu.
In Database Explorer, right-click the procedure and click Step Into or press F11 to start debugging.
To stop the debugging process, click Stop Debugging on the Debug toolbar or press Shift + F5.
To proceed with debugging, click Continue or press Ctrl + F5.
For more information about how to debug a stored procedure, see Debugging a Stored Procedure regarding the process of debugging the procedure.
In the Breakpoints pane, you can do the following:
Note
You can also debug a package from other PL/SQL programs, which call package procedures or functions using the same way for schema procedures and functions debugging.