Parameter Declaration

A parameter declaration can appear in in following:

Syntax

parameter_declaration ::=

parameter_declaration
Description of the illustration parameter_declaration.gif

(datatype ::=, expression ::=)

Keyword and Parameter Descriptions

datatype

The data type of the parameter that you are declaring. You cannot constrain this data type (with NOT NULL, for example).

IN, OUT, IN OUT

Parameter modes that define the action of formal parameters. For summary information about parameter modes, see Table 8-1.

Note:

Avoid using OUT and IN OUT with functions. The purpose of a function is to take zero or more parameters and return a single value. Functions must be free from side effects, which change the values of variables not local to the subprogram.

NOCOPY

Specify NOCOPY to instruct the database to pass this argument as fast as possible. This clause can significantly enhance performance when passing a large value like a record, an index-by table, or a varray to an OUT or IN OUT parameter. IN parameter values are always passed NOCOPY.

  • When you specify NOCOPY, assignments made to a package variable may show immediately in this parameter, or assignments made to this parameter may show immediately in a package variable, if the package variable is passed as the actual assignment corresponding to this parameter.

  • Similarly, changes made either to this parameter or to another parameter may be visible immediately through both names if the same variable is passed to both.

  • If the subprogram is exited with an unhandled exception, then any assignment made to this parameter may be visible in the caller's variable.

These effects might or might not occur on any particular call. Use NOCOPY only when these effects would not matter.

parameter_name

The name of the formal parameter that you are declaring, which you can reference in the body of the subprogram.

{ := | DEFAULT } expression

Specifies a default value for an IN parameter. If the invoker of the subprogram specifies a value for the parameter, then expression is not evaluated for that invocation (see Example 8-7). Otherwise, the parameter is initialized to the value of expression. The value and the parameter must have compatible data types.

Examples

Related Topics