Packages: Overloading

Description: Packages can contain multiple iterations of procedures with the same name using different parameters. This is called ‘overloading’.

Identify An Overloaded PACKAGE
 
SELECT overload, position, argument_name, in_out, data_type
FROM all_arguments
ORDER BY overload, position;
 
 
CREATE OR REPLACE PACKAGE overload_pkgIS
  PROCEDURE insby(namein VARCHAR2);
  PROCEDURE insby(numbin PLS_INTEGER);
END overload_pkg;
/
 
========================================
 
 
CREATE OR REPLACE PACKAGE BODY overload_pkg IS
PROCEDURE local_proc(namein VARCHAR2, nameout OUT VARCHAR2) IS
BEGIN
  nameout := TRANSLATE(namein,'AEIOUaeiou','EIOUAeioua');
END local_proc;
--==========================================
PROCEDURE test_proc (namein  VARCHAR2) IS
 y PLS_INTEGER;
BEGIN
  SELECT MAX(seqno)+1
  INTO y
  FROM persons;
 
  INSERT INTO persons
  (seqno, name)
  VALUES
  (y, namein);
  COMMIT;
END test_proc;
 
PROCEDURE test_proc (numbin  PLS_INTEGER) IS
 y VARCHAR2(30);
BEGIN
  SELECT MAX(name)
  INTO y
  FROM persons;
 
  local(y, y);
 
  INSERT INTO persons
  (seqno, name)
  VALUES
  (numbin, y);
  COMMIT;
END test_proc;
 
END overload_pkg;
/

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.