Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 


Overloading oracle functions and stored procedures

Oracle Database Tips by Donald BurlesonJune 15, 2015

Question:  What does it mean to "overload" an Oracle stored procedure or function?  I hear that overloading has to do with what parameters are passed to the PL/SQL, but I was hoping for clarification into the nature of PL/SQL overloading.

Answer:  The process of "overloading" originates in the world of object-oriented coding with the concept of polymorphism.  It is the idea that the functionality of a PL/SQL stored procedure of function can be changed based on the input datatype.

Polymorphism was a spin off of the PL/SQL concept called "overloading"  Overloading a stored procedure or function refers to the ability of a programming method to perform more than one kind of operation depending upon the context in which the method is used. 

For a simple example of overloading, you can write a PL/SQL function that does one thing when a numeric argument is passed to the procedure and another thing when a character string is passed as an argument.

For a simple Oracle example of overloading, consider the wwv_flow_mail.send procedure.  There are two overloaded versions of the send procedure and Oracle knows which to invoke by the argument data types passed to the send procedure.  If you pass a CLOB datatype for p_body and p_body_html, then the second send procedure is invoked.

Polymorphism and overloading in PL/SQL

Polymorphism is the ability of different objects to receive the same message and respond in different ways.  Polymorphism simplifies the communication between objects by using a common interface to hide different implementation details. 

A very simple example of this is the use of the operator "+", in working with characters it can be used for concatenation and if used with numerical values it would be used for addition.  A programming example of overloading would look as follows. 

Concatenation example:

First_Name = "John"
Last_Name = "Smith"
Full_Name = First_Name + Last_Name


Numerical example

Kounter = Kounter + 1

Oracle member methods and overloading

Overloading is associated with the object-oriented idea of "polymorphism" whereby a single procedure may be context-sensitive, depending on the input parameters and it is also used in the object-oriented Oracle with the idea of member methods.

An example of this type of method would be an update method that updates a table attribute based on the value that is passed. If a date value is passed, the procedure will do the conversion to character, same with a number.
 
The technique for overloading a method procedure or function is identical to the overloading of standard procedure or function.

create type
   test3(
   type_passed varchar2(8),

   member procedure input_type(in_char char),
   member procedure input_type(in_varchar varchar2),
   member procedure input_type(in_date date),
   member procedure input_type(in_number number)
);

Click HERE for more information on Oracle stored procedures.

 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.


 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster