14 SQL Statements for Stored PL/SQL Units
This chapter explains how to use the SQL statements that create, change, and drop stored PL/SQL units.
CREATE [ OR REPLACE ] Statements
Each of these SQL statements creates a PL/SQL unit at schema level and stores it in the database:
Each of these CREATE statements has an optional OR REPLACE clause. Specify OR REPLACE to re-create an existing PL/SQL unit—that is, to change its declaration or definition without dropping it, re-creating it, and regranting object privileges previously granted on it. If you redefine a PL/SQL unit, the database recompiles it.
               
Caution:
A CREATE OR REPLACE statement does not issue a warning before replacing the existing PL/SQL unit.
                  
None of these CREATE statements can appear in a PL/SQL block.
               
ALTER Statements
To recompile an existing PL/SQL unit without re-creating it (without changing its declaration or definition), use one of these SQL statements:
Reasons to use an ALTER statement are:
               
- 
                     To explicitly recompile a stored unit that has become invalid, thus eliminating the need for implicit runtime recompilation and preventing associated runtime compilation errors and performance overhead. 
- 
                     To recompile a stored unit with different compilation parameters. 
- 
                     To enable or disable a trigger. 
- 
                     To specify the EDITIONABLEorNONEDITIONABLEproperty of a stored unit whose schema object type is not yet editionable in its schema.
The ALTER TYPE statement has additional uses.
               
DROP Statements
To drop an existing PL/SQL unit from the database, use one of these SQL statements:
Related Topics
- 
                        For instructions for reading the syntax diagrams in this chapter, see Oracle Database SQL Language Reference. 
- 
                        For information about editioned and noneditioned objects, see Oracle Database Development Guide. 
- 
                        For information about compilation parameters, see "PL/SQL Units and Compilation Parameters".