Oracle7 Server SQL Reference

Contents Index Home Previous Next

ALTER FUNCTION

Purpose

To recompile a stand-alone stored function.

Prerequisites

The function must be in your own schema or you must have ALTER ANY PROCEDURE system privilege.

If you are using Trusted Oracle7 in DBMS MAC mode, your DBMS label must match the function's creation label or you must satisfy one of these criteria:

Syntax

Keywords and Parameters

schema

is the schema containing the function. If you omit schema, Oracle7 assumes the function is in your own schema.

function

is the name of the function to be recompiled.

COMPILE

causes Oracle7 to recompile the function. The COMPILE keyword is required.

Usage Notes

You can use the ALTER FUNCTION command to explicitly recompile a function that is invalid. Explicit recompilation eliminates the need for implicit runtime recompilation and prevents associated runtime compilation errors and performance overhead.

The ALTER FUNCTION command is similar to the ALTER PROCEDURE command [*]. For information on how Oracle7 recompiles functions and procedures, see the "Dependencies Among Schema Objects" chapter of Oracle7 Server Concepts.

Note: This command does not change the declaration or definition of an existing function. To re-declare or redefine a function, you must use the CREATE FUNCTION command ([*]) with the OR REPLACE option.

Example

To explicitly recompile the function GET_BAL owned by the user MERRIWEATHER, issue the following statement:

ALTER FUNCTION merriweather.get_bal
 	COMPILE 

If Oracle7 encounters no compilation errors while recompiling GET_BAL, GET_BAL becomes valid. Oracle7 can subsequently execute it without recompiling it at runtime. If recompiling GET_BAL results in compilation errors, Oracle7 returns an error message and GET_BAL remains invalid.

Oracle7 also invalidates all objects that depend upon GET_BAL. If you subsequently reference one of these objects without explicitly recompiling it first, Oracle7 recompiles it implicitly at runtime.

Related Topics

ALTER PROCEDURE command [*] CREATE FUNCTION command [*]


Contents Index Home Previous Next