Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Package vs standalone for single function/procedure?
From the PL/SQL User Guide:
When you call a packaged subprogram for the first time, the whole
package is loaded into memory. So, later calls to related subprograms in
the package
require no disk I/O. Also, packages stop cascading dependencies and
thereby avoid unnecessary recompiling. For example, if you change the
definition of
a packaged function, Oracle need not recompile the calling subprograms
because they do not depend on the package body.
[and also this]
To reduce the need for recompiling when code is changed, place as few
items as possible in a package spec. Changes to a package body do not
require
Oracle to recompile dependent procedures. However, changes to a package
spec require Oracle to recompile every stored subprogram that references
the package.
Sybrand Bakker wrote:
>
> Hi Jonathan
>
> Regrettably my experiences with packages, both in 7.3 and 8i, are different.
> Maybe this is a Toad issue, but if I change the body only and compile it,
> *all* dependent code becomes invalid. Needless to say, this is a pita.
>
> Regards,
>
> Sybrand Bakker, Oracle DBA
>
> "Jonathan Lewis" <jonathan_at_jlcomp.demon.co.uk> wrote in message
> news:978621445.24660.1.nnrp-08.9e984b29_at_news.demon.co.uk...
> >
> > And there is (at least) one good reason for putting a
> > single function or procedure into a package - other
> > functions, procedures or packages may depend on it.
> >
> > If you rewrite a standalone function/procedure,
> > anything that depends on it becomes invalid
> > and has to be recompiled.
> >
> > If you rewrite a packaged function you only
> > recompile the package body, so the package
> > specification never becomes invalid, so all
> > the dependent objects remain valid.
> >
> >
> > --
> >
> >
> > Keith Jamieson wrote in message <9322qm$3ti$1_at_kermit.esat.net>...
> > >
> > >So, it is not really sensible to put just one function or procedure into
a
> > >package, unless you have some other good reason to do so.
> > >
-- "No man is happy without a delusion of some kind. Delusions are as necessary to our happiness as realities."Received on Thu Jan 25 2001 - 05:41:14 CST
![]() |
![]() |