?
Solved

Usage of NOCOPY in database procedures

Posted on 2007-03-27
4
Medium Priority
?
967 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 77

Expert Comment

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

Accepted Solution

by:
zilva earned 150 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 77

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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
Suggested Courses

801 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