Compile

From RapidSQL
Jump to: navigation, search

Go Up to Available object actions by DBMS

You can recompile specific objects by issuing the proper ALTER statement. The explicit recompilation of invalid objects eliminates the need for implicit run-time recompilation which, in turn, can cause run-time compilation errors and performance overhead. Recompile objects after you make changes to that object or dependent objects.

The following table lists the object types by DBMS for which the Compile operation is available:

DB2 LUW

Procedures

Oracle

Functions

Java Sources

Materialized Views

Packages

Package Bodies

Procedures

Schema

Types and Type Bodies

Views

Note: The objects you can compile and the steps in compiling them differ according to the type of data source you are working against. Before proceeding, make sure you are familiar with the material in Compiling Oracle Objects.

To Compile an Object

  1. Initiate a Compile action against one or more supported objects (see the table above). For more information see Initiating an object operation.
    The Compile wizard opens. Options offered on the Action Options tab differ by object type. For example, no options are provided when compiling Java Sources, while a full range of dependent object-based and debug options are provided when compiling procedures.
  2. Use the following table as a guide to working through the panels of the dialog box
Step Settings and tasks Availability

Action options

Compile dependents

If enabled, this option compiles statements for all objects referenced by the object being compiled. For example, if you compile a function that references a specific procedure and you select to compile the dependent objects, an ALTER COMPILE statement is created for that referenced procedure. If disabled, only the current object is compiled and the object’s dependencies are ignored. This is the default setting.

DB2 LUW Procedures Oracle Functions, Packages, Procedures, Types, and Views

Compile only invalid dependents

If you enabled the Compile dependents option, enabling this option compiles only invalid dependent objects - Creates ALTER COMPILE statements for only those objects that are currently invalid.

DB2 LUW Procedures Oracle Functions, Packages, Procedures, Types, and Views

Compile system dependents

If you enabled the Compile dependents option, enabling this option compiles dependent system objects - Compiles all of the referenced objects with the debug option.

DB2 LUW Procedures Oracle Functions, Packages, Procedures, Types, and Views

Compile with debug

Enabling this option instructs the Oracle PL/SQL compiler to generate and store the code for use in debugging sessions.

DB2 LUW Procedures Oracle Functions, Packages, Package Bodies, Procedures, Types, Type Bodies, and Views

Keep specific name

When enabled, compilation will keep the current name.

DB2 LUW Procedures

Dependencies

Lets you review any dependencies before you proceed. For more information, see Dependencies.

Preview

Displays the DDL generated to execute the Checkpoint operation. For more information, see Preview.

3. Click Execute. For information on the scheduling option, see Scheduling.

Compiling Oracle Objects

To recompile an object it must belong to your schema or you need ALTER ANY privileges on that object. You must also have appropriate privileges for any associated objects. Prior to compiling objects of a particular type, see the relevant topic below:

Notes on Compiling Oracle Functions

You can recompile a function. Oracle first recompiles any invalid objects on which the function depends. In addition, it marks any objects that depend on the function as invalid.

To recompile a function that is part of a package, compile the package itself. An ALTER FUNCTION statement to compile a stand-alone function. However, you should not use the ALTER FUNCTION statement to individually recompile a function that is part of a package.

Notes on Compiling Oracle Java Sources

Oracle lets you compile a Java source. Oracle resolves references to other Java sources.

Notes on Compiling Oracle Materialized Views

You can compile materialized views. If a materialized view fails to revalidate after you recompile, that materialized view cannot be fast refreshed ON DEMAND or used for query rewrite.

Notes on Compiling Oracle Packages and Package Bodies

You can recompile a package and recompile all package objects together.

Recompiling a package compiles both the package specification and the package body by issuing two consecutive ALTER statements. However, only the ALTER statement is shown for the specification in the Preview: Confirm Compile dialog. You can recompile only the package body by explicitly compiling the package body itself.

When recompiling the entire package, Oracle recompiles the package even if it is invalid. However, if there are compilation errors, the package remains invalid and Oracle invalidates all dependent objects.

Recompiling only a package body does not invalidate objects that depend upon the package specification regardless of whether or not the package body has compilation errors.

Notes on Compiling Oracle Procedures

You can compile a procedure that is part of a package, by compiling the package itself. The ALTER PROCEDURE statement is used to compile a stand-alone procedure. However, you should not use the ALTER PROCEDURE statement to individually recompile a procedure that is part of a package.

Notes on Compiling Oracle Types and Type Bodies

You can recompile a type. Both the type specification and the type body are recompiled.

Notes on Compiling Oracle Views

You can recompile a view when you have altered an object referenced by that view.

When you recompile a view, Oracle invalidates all dependent objects.