Running and Debugging Functions, Procedures, and Packages

Instead of manually testing PL/SQL functions and procedures as you may be accustomed to doing from within SQL*Plus or by running a dummy procedure in the database, JDeveloper lets you test these objects in an automatic way. With this release of JDeveloper, you can run and debug PL/SQL program units. For example, you can specify parameters being passed or return values from a function giving you more control over what is run and providing you output details about what was tested.

Note: The procedures or functions in the Oracle database can be either standalone or within a package.

To run or debug functions, procedures, and packages:

  1. Create a database connection using the Database Wizard.

  2. In the Navigator, expand the Database node to display the specific database user name and schema name.

  3. Expand the Schema node.

  4. Expand the the appropriate node depending on what you are debugging: Procedure, Function or Package body.

  5. (Optional for debugging only) Select the function, procedure, or package that you want to debug and double-click to open it in the Code Editor.

  6. (Optional for debugging only) Set a breakpoint in your PL/SQL code by clicking to the left of the margin.

    Note: The breakpoint must be set on an executable line of code. If the debugger does not stop, the breakpoint may have not been set on an executable line of code (verify that the breakpoint was verified). Also, verify that the debugging PL/SQL prerequisites were met. In particular, make sure that the PL/SQL program is compiled in INTERPRETED mode.

  7. Make sure that either the Code Editor or the procedure in the Navigator is currently selected.

  8. Click the debug_icon Debug toolbar button or if you want to run without debugging, press the run_icon Run toolbar button.

  9. The Run PL/SQL dialog is displayed.

    1. Select a T arget which is the name of the procedure or function that you want to debug. Notice that the content in the P arameters and PL/SQL Block boxes change dynamically when the target changes.

      Note: You will have a choice of target only if you choose to run or debug a package that contains more than one program unit.

    2. The Parameters box lists the target's arguments (if applicable).

    3. The PL/SQL Block box displays code that was custom generated by JDeveloper for the selected target. Depending on what the function or procedure does, you may need to replace the NULL values with reasonable values so that these are passed into the procedure, function, or package. In some cases, you may need to write additional code to initialize values to be passed as arguments. In this case, you can edit the PL/SQL block text as necessary.

  10. Click OK to execute or debug the target.

  11. Analyze the output information displayed in the Log window.

    In the case of functions, the return value will be displayed. DBMS_OUTPUT messages will also be displayed.


Related topics

Locally Debugging PL/SQL Programs
About Remote Debugging Java Programs
Moving Through Code While Debugging

 

Copyright © 1997, 2004, Oracle. All rights reserved.