Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Packages vs. Procedure
A copy of this was sent to NBronke_at_t-online.de (Nicolas Bronke)
(if that email address didn't require changing)
On 24 Sep 1998 17:30:52 GMT, you wrote:
>When is it necessary to use packages? For the time beeing I found only the
>advantage if I use global variables. Is that right?
>
>Regards
>Nicolas
>
>
In addition to some of the other postings about the advantages of packages (encapsulation, minimizing database objects - since a package has many procedures/functions) the MAJOR benefit of packages is that the break the dependency chain.
packages come in 2 parts -- the specification and the body. The spec tells us the public interface to the procedures/functions in the body -- things other procedures/functions may call. The spec is typically written once and doesn't change frequently.
When we build other objects in the database that call procedures/functions in some other package -- these new objects are dependent on the package SPEC they call -- not the body. What this means is that if the package spec never gets recompiled (and it shouldn't after a while, the bugs in the code will be in the body -- not the spec which has no code) then dependent objects will not get invalidated when we recompile the body.
So, using a spec and body can massively cut down on the amount of implicit compiling that takes place -- increasing performance.
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Sep 25 1998 - 07:50:24 CDT
![]() |
![]() |