question

OracleApprender avatar image
OracleApprender asked

What is Over Loading and what are its restrictions ?

Can anybody explain me briefly what is the Overloading in PL/SQL and please let me know if any restrictions of this in Oracle. Thank you.

oracleplsql
10 |1200

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

Overloading of Procedures is discussed here:

Oracle Docs - Procedures

Briefly, it's a way of assigning two different kinds of operation to a single procedure name, depending on the type or number of values passed. You could create a procedure, PLUS, that had two different implementations, depending on what was passed. PLUS can be a reasonable operation for both strings and numbers but would probably work in two different ways...

PLUS (1, 1) yields 2, an arithmetic addition.

PLUS ('1','1') yields '11', a concatenation.

The restrictions are discussed on that page and there's a good example or two.

10 |1200

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

HillbillyToad avatar image
HillbillyToad answered

You can find a great example in DBMS_OUTPUT. You'll see an overloaded procedure called 'GET_LINES'. I think the only restriction is that each overloaded object must have a unique set of input params.

Packages - Module Overloading Module Overloading

10 |1200

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.