question

OraLearner avatar image
OraLearner asked

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.

oracleparametersfunction
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KillerDBA avatar image
KillerDBA answered

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

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

OraLearner avatar image
OraLearner answered

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

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.