13.50 Procedure Declaration and Definition
Before invoking a procedure, you must declare and define it. You can either declare it first (with procedure_declaration) and then define it later in the same block, subprogram, or package (with procedure_definition) or declare and define it at the same time (with procedure_definition).
A procedure is a subprogram that performs a specific action. A procedure invocation (or call) is a statement.
A procedure declaration is also called a procedure specification or procedure spec.
Note:
For more information about standalone procedures, see "CREATE PROCEDURE Statement". For more information about package procedures, see "CREATE PACKAGE Statement".
Topics
Syntax
procedure_declaration ::=
procedure_heading ::=
See "parameter_declaration ::=".
procedure_properties ::=
( accessible_by_clause ::= , default_collation_clause ::= , invoker_rights_clause ::= )
procedure_definition ::=
( body ::= , declare_section ::= , call_spec ::= )
Semantics
procedure_declaration
Declares a procedure, but does not define it. The definition must appear later in the same block, subprogram, or package as the declaration.
procedure_heading
procedure
Name of the procedure that you are declaring or defining.
procedure_properties
Each procedure property can appear only once in the procedure declaration. The properties can appear in any order. Properties appear before the IS
or AS
keyword in the heading. The properties cannot appear in nested procedures. Only the ACCESSIBLE BY
property can appear in package procedures.
Standalone procedures may have the following properties in their declaration.
procedure_definition
Either defines a procedure that was declared earlier or both declares and defines a procedure.
declare_section
Declares items that are local to the procedure, can be referenced in body
, and cease to exist when the procedure completes execution.
body
Required executable part and optional exception-handling part of the procedure.
Examples
-
Example 8-1, "Declaring, Defining, and Invoking a Simple PL/SQL Procedure"
Related Topics
In this chapter:
In other chapters: