x

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, 2010 at 12:03 PM in Default

OraLearner gravatar image

OraLearner
1.3k 78 86 88

(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, 2010 at 03:36 AM

KillerDBA gravatar image

KillerDBA
1.5k 8 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, 2010 at 12:34 PM

OraLearner gravatar image

OraLearner
1.3k 78 86 88

(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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

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

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x378
x75
x19

asked: Jan 11, 2010 at 12:03 PM

Seen: 2469 times

Last Updated: Jan 12, 2010 at 11:26 AM