Your browser does not support JavaScript. This help page requires JavaScript to render correctly. Tutorial: Creating a Package Body
Skip Headers
Previous
Previous
 
Next
Next

Tutorial: Creating a Package Body

To create a package body, use either the SQL Developer tool Create Body or the DDL statement CREATE PACKAGE BODY.

This tutorial shows how to use the Create Body tool to create a body for the EMP_EVAL package (created in "Tutorial: Creating a Package Specification" and changed in "Tutorial: Changing a Package Specification").

This package body will contain the implementation details of the sample application that the tutorials and examples in this document show how to develop and deploy.

To create a body for the package EMP_EVAL using the Create Body tool:

  1. On the Connections tab, expand hr_conn.

    Under the hr_conn icon, a list of schema object types appears.

  2. Expand Packages.

    A list of packages appears.

  3. Right-click EMP_EVAL.

    A list of choices appears.

  4. Click Create Body.

    The EMP_EVAL Body pane appears, showing the automatically generated code for the package body.

    The title of the pane is in italic font, which indicates that the code is not saved in the database.

  5. (Optional) In the CREATE PACKAGE BODY statement:

    • Replace the comments with executable statements.

    • (Optional) In the executable part of the procedure, either delete NULL or replace it with an executable statement.

    • (Optional) In the executable part of the function, either replace NULL with another expression.

    If you do not do this step now, you can do it later, as shown in "Tutorial: Declaring Variables and Constants in a Subprogram".

  6. Click the icon Compile.

    The changed package body compiles and is saved to the database. The title of the EMP_EVAL Body pane is no longer in italic font.

Related Topics

Oracle Database PL/SQL Language Reference

Creating and Managing Packages