x
login about faq Site discussion (meta-askssc)

Can 2 functions have the same name & input parameters but differ only by return datatype ?

My scenario is that I want to use the same named 2 functions with the same type of input parameters. Will it be possibile to have this with different return types ? Thank you.

more ▼

asked Jan 11 '10 at 12:03 PM in Default

OraLearner gravatar image

OraLearner
1.3k 55 70 83

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

No. To overload a function, you must change the "signature" of the function, which is the defined by the position and datatype of the inputs. The return value is not part of the signature, so it can't be used for overloading.

"Oracle Database 11g PL/SQL Programming," by Michael McLaughlin, page 318

more ▼

answered Jan 17 '10 at 03:36 AM

KillerDBA gravatar image

KillerDBA
1.5k 5 9 10

(comments are locked)
10|1200 characters needed characters left

The answer is NO. Since we cannot overload the functions based on its return types.

more ▼

answered Jan 12 '10 at 12:34 PM

OraLearner gravatar image

OraLearner
1.3k 55 70 83

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x362
x67
x12

asked: Jan 11 '10 at 12:03 PM

Seen: 1657 times

Last Updated: Jan 12 '10 at 11:26 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.