Skip Headers
Oracle® Database SQL Language Reference
11g Release 1 (11.1)

Part Number B28286-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Go to next page
View PDF



Use the ALTER PROCEDURE statement to explicitly recompile a standalone stored procedure. Explicit recompilation eliminates the need for implicit run-time recompilation and prevents associated run-time compilation errors and performance overhead.

To recompile a procedure that is part of a package, recompile the entire package using the ALTER PACKAGE statement (see ALTER PACKAGE).


This statement does not change the declaration or definition of an existing procedure. To redeclare or redefine a procedure, use the CREATE PROCEDURE statement with the OR REPLACE clause (see CREATE PROCEDURE).

The ALTER PROCEDURE statement is quite similar to the ALTER FUNCTION statement. Refer to ALTER FUNCTION for more information.


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



Description of alter_procedure.gif follows
Description of the illustration alter_procedure.gif


Description of compiler_parameters_clause.gif follows
Description of the illustration compiler_parameters_clause.gif



Specify the schema containing the procedure. If you omit schema, then Oracle Database assumes the procedure is in your own schema.


Specify the name of the procedure to be recompiled.


Specify COMPILE to recompile the procedure. The COMPILE keyword is required. Oracle Database recompiles the procedure regardless of whether it is valid or invalid.

During recompilation, Oracle Database drops all persistent compiler switch settings, retrieves them again from the session, and stores them at the end of compilation. To avoid this process, specify the REUSE SETTINGS clause.

See Also:

Oracle Database Concepts for information on how Oracle Database maintains dependencies among schema objects, including remote objects and "Recompiling a Procedure: Example"


Specify DEBUG to instruct the PL/SQL compiler to generate and store the code for use by the PL/SQL debugger. Specifying this clause is the same as specifying PLSQL_DEBUG = TRUE in the compiler_parameters_clause.

See Also:

Oracle Database Advanced Application Developer's Guide for information on debugging procedures


This clause has the same behavior for a procedure as it does for a function. Refer to the ALTER FUNCTION compiler_parameters_clause.


This clause has the same behavior for a procedure as it does for a function. Refer to the ALTER FUNCTION clause REUSE SETTINGS.


Recompiling a Procedure: Example To explicitly recompile the procedure remove_emp owned by the user hr, issue the following statement:

ALTER PROCEDURE hr.remove_emp

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

Oracle Database also invalidates all dependent objects. These objects include any procedures, functions, and package bodies that call credit. If you subsequently reference one of these objects without first explicitly recompiling it, then Oracle Database recompiles it implicitly at run time.