Skip to main content
← PL/SQL Topics

Packages & Modularity

Explain procedure/function overloading in PL/SQL packages

Overloading

ExplanationOracle Fusion / EBS · Technical · PL/SQLHigh confidenceGenerated

Multiple subprograms in one package can share a name if their parameter lists differ enough.

How it works

Within one package, two or more subprograms can share the same name as long as their parameter lists differ enough for PL/SQL to pick the right one at compile time — a different number of parameters, or parameters of different (non-family) datatypes. Parameter names and default values alone aren't enough to distinguish two overloads from each other.

How it works
CREATE OR REPLACE PACKAGE fmt_pkg AS
  FUNCTION format_value(p_value NUMBER) RETURN VARCHAR2;
  FUNCTION format_value(p_value DATE) RETURN VARCHAR2;
END fmt_pkg;
/

CREATE OR REPLACE PACKAGE BODY fmt_pkg AS
  FUNCTION format_value(p_value NUMBER) RETURN VARCHAR2 IS
  BEGIN
    RETURN TO_CHAR(p_value, '999,999.00');
  END;

  FUNCTION format_value(p_value DATE) RETURN VARCHAR2 IS
  BEGIN
    RETURN TO_CHAR(p_value, 'DD-MON-YYYY');
  END;
END fmt_pkg;
/

Related questions

GroundingGenerated

Model-generated, grounded against the curated knowledge layer. Check specifics against your instance.

Have a follow-up, or a different question?

Continue in Ask Oracle AI