Packages

Oracle packages are broken down into two parts. These are the specification and the body. The specification is just a declaration for external users of the package. The body is the code of the package. There is only one copy of the package code in memory for all users.

The package body needs to match the specification for the exported functions and procedures. It is possible for a package to not have a body. This scenario happens when the package does not have any functions or procedures. A concrete example is a package that just defines constants.

You have the ability to overload functions and procedures within a package. This is not unique to Oracle. Overloading is when you have multiple functions/procedures with the same name. The one that gets executed is the one that has the matching number and types of arguments as how you call it.

There is a special optional section of code where the package can be initialized. It must come at the end of the package. It is called the first time a session calls the package. Next time I will talk a little bit more about packages. I will specifically go into some built in packages from Oracle.