Oracle8i SQL Reference
Release 3 (8.1.7)

Part Number A85397-01

Library

Product

Contents

Index

Go to previous page Go to beginning of chapter Go to next page

SQL Statements:
ALTER CLUSTER to ALTER SYSTEM, 5 of 19


ALTER FUNCTION

Purpose

Use the ALTER FUNCTION statement to recompile an invalid standalone stored function. Explicit recompilation eliminates the need for implicit run-time recompilation and prevents associated run-time compilation errors and performance overhead.

The ALTER FUNCTION statement is similar to ALTER PROCEDURE. For information on how Oracle recompiles functions and procedures, see Oracle8i Concepts.


Note: This statement does not change the declaration or definition of an existing function. To redeclare or redefine a function, use the CREATE FUNCTION statement with the OR REPLACE clause; see CREATE FUNCTION


Prerequisites

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

Syntax


Keywords and Parameters

schema

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

function

Specify the name of the function to be recompiled.

COMPILE

Specify COMPILE to cause Oracle to recompile the function. The COMPILE keyword is required. If Oracle does not compile the function successfully, you can see the associated compiler error messages with the SQL*Plus command SHOW ERRORS.

DEBUG

Specify DEBUG to instruct the PL/SQL compiler to generate and store the code for use by the PL/SQL debugger.

Example

Recompiling a Function Example

To explicitly recompile the function get_bal owned by the user merriweather, issue the following statement:

ALTER FUNCTION merriweather.get_bal
   COMPILE; 

If Oracle encounters no compilation errors while recompiling get_bal, get_bal becomes valid. Oracle can subsequently execute it without recompiling it at run time. If recompiling get_bal results in compilation errors, Oracle returns an error, and get_bal remains invalid.

Oracle also invalidates all objects that depend upon get_bal. If you subsequently reference one of these objects without explicitly recompiling it first, Oracle recompiles it implicitly at run time.


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index