What is a NOCOPY parameter in Oracle?- Apart from IN, OUT, IN OUT parameters, oracle 8i offers another parameter called NOCOPY.
Where OUT and IN OUT are implemented as copy out and copy-in/copy out respectively, NOCOPY directs the compiler to not create a copy of a variable. It rather passes it as a reference.
- It requests that the compiler pass the corresponding actual parameter by reference instead of value.
- Each time the subprogram is invoked, the optimizer decides, silently, whether to obey or disregard NOCOPY.
- NOCOPY increases the likelihood of aliasing.
- The compiler ignores NOCOPY in these cases:
- The actual parameter must be implicitly converted to the data type of the formal parameter.
- The actual parameter is the element of a collection.
- The actual parameter is a scalar variable with the NOT NULL constraint.
- The actual parameter is a scalar numeric variable with a range, size, scale, or precision constraint.
- The actual and formal parameters are records, one or both was declared with %ROWTYPE or %TYPE, and constraints on corresponding fields differ.
- The actual and formal parameters are records, the actual parameter was declared (implicitly) as the index of a cursor FOR LOOP statement, and constraints on corresponding fields differ.
- The subprogram is invoked through a database link or as an external subprogram.
|