Solved

Usage of NOCOPY in database procedures

Posted on 2007-03-27
4
945 Views
Last Modified: 2011-10-03
Hi

We use "NOCOPY" keyword in Oracle database procedures?  Can anyone tell me what is the significance of "NOCOPY"?

Advance thanks

Srigupta
0
Comment
Question by:srigupta
  • 2
4 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 18803106
0
 
LVL 2

Accepted Solution

by:
zilva earned 50 total points
ID: 18806022
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.
0
 

Author Comment

by:srigupta
ID: 18810759
Hi

Thanks to all for your help.

Srigupta
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 18811422
zilva,

For future reference if you're going to copy and paste an answer, please give credit to the original author and at least give the URL:
http://www.remote-dba.net/t_easyoracle_pl_sql_nocopy_clause_inout_variable.htm
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now