Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


why we use nocopy?

Answers were Sorted based on User's Feedback



why we use nocopy?..

Answer / shivaindu

When you use a Collection (Records, VARRAY etc having
records of data) as a Return type (OUT or IN OUT parameter)
as we know, it will be passed by value only. That means the
entire data will be copied to the formal parameter location,
which leads to lot of CPU and memory consumption.

Here comes the usage of NOCOPY parameter. Provide NOCOPY
after the OUT/IN OUT parameter, which instructs the PL/SQL
Engine to avoid using the pass by value method. So, the
Engine uses pass by reference instead. This helps reducing a
lot of CPU usage as well as memory consumption.
Eg: Just an example how to put the NOCOPY parameter.

PROCEDURE PRC_NOCOPY_EXAMPLE
(
P_EMPNO IN
NUMBER,
P_ENAME IN
VARCHAR2(50),
P_SAL OUT NOCOPY
RECORD_SAL --PL/SQL Record
);
REC_SAL RECORD_SAL;

Now if you call the Procedure PRC_NOCOPY_EXAMPLE, the
parameter P_SAL would only use Pass by reference method.
Disadvantage:
However, you need to be extremely careful while
using this method in coding for high priority data
transactions. When you pass parameters to a procedure by
reference, any change that happens on the passed Parameters
gets updated in the same memory location as the Actual
parameter. So when an exception occurs in a
procedure/function, these changes are not Rolled back . To
be precise, the PL/SQL engine cannot rollback these
parameter changes. So, if the actual values get changed,
then it may result in incorrect results.
Thus, to conclude, it is up to a Developer to take a
trade-off between using or not using the NOCOPY parameter.
NOCOPY could provide better performance by reducing Memory
and CPU cost, but at the same time, could result in
incorrect results too.

Is This Answer Correct ?    4 Yes 0 No

why we use nocopy?..

Answer / suresh somayajula

OUT and IN OUT Parameters which will avoid copy overhead.so we will use NOCOPY.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What is the best sql course?

0 Answers  


What is the basic structure of an sql?

0 Answers  


What is a sql profiler?

0 Answers  


Explain commit, rollback and savepoint.

0 Answers  


What are aggregate and scalar functions?

0 Answers  


What is string join?

0 Answers  


Why schema is used in sql?

0 Answers  


What are the differences between in and exists clause?

0 Answers  


How much does sql cost?

0 Answers  


What is identity column in sql server?

0 Answers  


how to enter binary numbers in sql statements? : Sql dba

0 Answers  


how tsql statements can be written and submitted to the database engine? : Transact sql

0 Answers  


Categories