10.9. Overloading

You can overload the procedure or function in a package. The best example of overloading is the Oracle built-in DBMS_OUTPUT package. It provides a print procedure to display a string:

PUT_LINE(parameter VARCHAR2)

Other types can be printed including a DATE and NUMBER type. This leads to overloaded procedures:

PUT_LINE(parameter VARCHAR2)
PUT_LINE(parameter DATE)
PUT_LINE(parameter NUMBER)

You overload procedures when identical functionality is performed on different types. You can technically overload procedures that perform unrelated functions. This practice makes code that uses your package vague, hard to read, and hard to understand.

Subprograms within a package can be overloaded only when the parameter profile is different. ...

Get Programming Oracle® Triggers and Stored Procedures, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.