||Oracle Tips by Burleson
The final point to cover in passing variables
is the NOCOPY clause
. When a parameter is passed as an
IN variable, it is passed by reference. Since it will not change,
PL/SQL uses the passed variable in the procedure/function. When
variables are passed in OUT or INOUT mode, a new variable
is define, and the value is copied to the passed variable when the
procedure ends. If the variable is a large structure such as a PL/SQL
table or an array, the application could see a performance degradation
cause by copying this structure.
The NOCOPY clause tells to PL/SQL engine to pass
the variable by reference, thus avoiding the cost of copying the
variable at the end of the procedure. The PL/SQL engine has
requirements that must be met before passing the variable by reference
and if those requirements are not met, the NOCOPY clause will simply
be ignored by the PL/SQL engine.
If an OUT or INOUT variable is passed
by reference (NOCOPY) and the procedure terminates due to an
unhandled exception (ends abnormally), the value of the referenced
variable may no longer be valid.
Both stored procedures and functions are
passed variables, the only difference is that a function can only be
passed IN variables because a function returns a value.
The above book excerpt is from:
Easy Oracle PL/SQL Programming
Fast with Working PL/SQL Code Examples