Dear debas and friends,
1)what is the use of NOCOPY parameter?
2)function overloading
-------------------------------
which are the correct function overloading:
1) function f1(c in number)
return number
function f2(c in number)
return number
2) function f1(c in varchar)
return number
function f2(c in varchar)
return number
3)function f1(c in number)
return varchar
function f2(c in number)
return varchar
4)function f1(c in varchar)
return varchar
function f2(c in number)
return number
5) function f1(c in varchar)
return varchar
function f2(c in varchar)
return varchar
6) function f1(c in number)
return varchar
function f2(c in varchar)
return varchar
7)function f1(c in number)
return number
function f2(c in varchar)
return varchar
8)function f1(c in varchar)
return number
function f2(c in varchar)
return varchar
9)function f1(c in number)
return varchar
function f2(c in varchar)
return number
10)function f1(c in varchar)
return number
function f2(c in number)
return varchar
11)function f1(c in varchar)
return varchar
function f2(c in number)
return varchar
12)function f1(c in number)
return number
function f2(c in number)
return varchar
13)function f1(c in varchar)
return varchar
function f2(c in varchar)
return number
14)function f1(c in number)
return varchar
function f2(c in varchar)
return varchar
Thanks and reply..
Arun
6 11529
Function overloading means 2 or more functions with same name but with different signature.
In oracle function overloading can only be defined with in package.
None of your ex shows function overloading as name is different.
Example of FUNCTION OVERLOADING
-------------------------------------------------------------
Package specification -
CREATE OR REPLACE PACKAGE PKG_UTIL
-
AS
-
FUNCTION TRANS_DATE(DT IN DATE)RETURN NUMBER;
-
FUNCTION TRANS_DATE(DT IN NUMBER)RETURN DATE;
-
END PKG_UTIL;
-
Package body -
CREATE OR REPLACE PACKAGE BODY PKG_UTIL AS
-
-
FUNCTION TRANS_DATE(DT IN DATE)RETURN NUMBER IS
-
BEGIN
-
RETURN ROUND((DT-TO_DATE('01011970','MMDDYYYY'))*86400);
-
END TRANS_DATE;
-
-
FUNCTION TRANS_DATE(DT IN NUMBER)RETURN DATE IS
-
BEGIN
-
RETURN (TO_DATE('01011970','MMDDYYYY') +(DT/(86400)));
-
END TRANS_DATE;
-
-
END PKG_UTIL;
-
In this case the name of both the functions are same
But their signature is different.
while the first function accepts a date as parameter and returns a number
the 2nd accepts a number and returns a date.
The NOCOPY compiler hint increases the possibility of aliasing (that is, having two different names refer to the same memory location). This can occur when a global variable appears as an actual parameter in a subprogram call and then is referenced within the subprogram. The result is indeterminate because it depends on the method of parameter passing chosen by the compiler.
If you exit a subprogram successfully, PL/SQL assigns values to OUT parameters. However, if you exit with an unhandled exception, PL/SQL does not assign values to OUT parameters (unless they are NOCOPY parameters).
Restrictions on NOCOPY
=============== ==============
The use of NOCOPY increases the likelihood of parameter aliasing.
Remember, NOCOPY is a hint, not a directive. In the following cases, the PL/SQL compiler ignores the NOCOPY hint and uses the by-value parameter-passing method;
No error is generated:
■ The actual parameter is an element of an associative array. This restriction does not apply if the parameter is an entire associative array.
■ The actual parameter is constrained, such as by scale or NOT NULL. This restriction does not apply to size-constrained character strings. This restriction does not extend to constrained elements or attributes of composite types.
■ The actual and formal parameters are records, one or both records were declared using %ROWTYPE or %TYPE, and constraints on corresponding fields in the records differ.
■ The actual and formal parameters are records, the actual parameter was declared (implicitly) as the index of a cursor FOR loop, and constraints on corresponding fields in the records differ.
■ Passing the actual parameter requires an implicit datatype conversion.
■ The subprogram is called through a database link or as an external procedure.
Arun I Hope this much will suffice your purpose.
Restrictions on NOCOPY
=============== ==============
The use of NOCOPY increases the likelihood of parameter aliasing.
Remember, NOCOPY is a hint, not a directive. In the following cases, the PL/SQL compiler ignores the NOCOPY hint and uses the by-value parameter-passing method;
No error is generated:
■ The actual parameter is an element of an associative array. This restriction does not apply if the parameter is an entire associative array.
■ The actual parameter is constrained, such as by scale or NOT NULL. This restriction does not apply to size-constrained character strings. This restriction does not extend to constrained elements or attributes of composite types.
■ The actual and formal parameters are records, one or both records were declared using %ROWTYPE or %TYPE, and constraints on corresponding fields in the records differ.
■ The actual and formal parameters are records, the actual parameter was declared (implicitly) as the index of a cursor FOR loop, and constraints on corresponding fields in the records differ.
■ Passing the actual parameter requires an implicit datatype conversion.
■ The subprogram is called through a database link or as an external procedure.
Arun I Hope this much will suffice your purpose.
This helped me a lot. Thanks debas.
oohh, well and good..
thanks,
Arun..
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Doran_Dermot |
last post by:
Hi All,
I've seen lots of code in which the attributes of a class are accessed and
modified using two separate methods. For example:
class Problems:
def __init__( self, refNum ):
self._refNum = refNum
self._title = ""
self._problem = ""
|
by: Dave Theese |
last post by:
Hello all,
I'm trying to get a grasp of the difference between specializing a function
template and overloading it. The example below has a primary template, a
specialization and an overload. Note that the overload is identical to the
specialization except, of course, for the missing "template <>".
I don't know if my questions will be a bit too broad or not, but I thought
I'd give it shot... When is overloading preferable to...
|
by: WittyGuy |
last post by:
Hi,
What is the major difference between function overloading and function
templates?
Thanks!
http://www.gotw.ca/resources/clcm.htm for info about ]
|
by: zeus |
last post by:
I know function overloading is not supported in C.
I have a few questions about this:
1. Why? is it from technical reasons? if so, which?
2. why wasn't it introduced to the ANSI?
3. Is there any C implementation supporting this feature?
I assume some of you will claim that there is no need in function
overloading, so I would like to know your arguments too.
Thanks,
|
by: JaSeong Ju |
last post by:
I would like to overload a C function. Is there any easy way to do this?
| |
by: asdf |
last post by:
They looks so similar. Anybody would like to tell me their differences?
Thanks a lot.
|
by: lordkain |
last post by:
is it possible to do some kind of function overloading in c? and that
the return type is different
|
by: subramanian100in |
last post by:
The following is a beginner's question.
Suppose TYPE1 and TYPE2 are two types for which suitable ctors and
operator= are defined.
Suppose I have
class Test
{
TYPE1 mem1;
|
by: Matthew |
last post by:
Am I correct in thinking there is no method/function overloading of any
kind in any version of PHP?
Thanks,
Matthew
|
by: mesut |
last post by:
hi colleagues,
I don't know if this is the right group for but it's in C# so I try.
I have a #3 procedural function called GetInfo.. and those are 3
overloaded methods. I would like to use the OOP approach to refactor
this.
The functions are working fine but I would like to have a OOP approach
can someone help me refactoring this??????
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |