Is it possible to define package procedure/function outside of package body block (for Oracle)?

Simplified syntax for defining package body is:

create or replace package body <package_name> IS

  function <function_name>

  procedure <procedure_name>

end <package_name>;

Is it possible to define procedure within package like:

procedure <package_name>.<procedure_name>

I ask this question as I am newbie and don't understand why I need to compile whole package when I need only to apply changes form a single procedure...


Tom says:

  • Always use a package.
  • Never use a standalone procedure except for demos, tests and standalone utilities (that call nothing and are called by nothing)

2 Answers 2


You always need to compile the entire package body -- it is one item of code. You can create functions and procedures inside other procedures, but that does not change the need to recompile the package body.

What problem are you trying to solve here?

  • Thanks for answer.+1 As I say in question I am in situation when I have to apply fix to procedure from package. For newbie it is unclear that I must apply whole package in order to integrate small bug fix to part of package....
    – gavenkoa
    Commented May 24, 2013 at 10:09
  • 1
    Yes, that's the case I'm afraid. Just recompile the package body though, not the package, unless the interface with any of the procedures or functions has changed. The package body is separated from the package so that recompilation of the body does not cause invalidation of other objects. Commented May 24, 2013 at 10:12
  • Thanks again! I had another question about recompilation of package header vs body and you answered it in comment!!
    – gavenkoa
    Commented May 24, 2013 at 10:58
  • 1
    Ah, well remember that when you're deploying code the best approach is to deploy all of the packages and then deploy the package bodies. You won't have to think about which order to deploy the individual packages in. Commented May 24, 2013 at 11:01

Not there. But your idea is a good one....

In Ada, which was the origin of PL/SQL, you could define a part of a package body, like a procedure, as "separate".

This would allow you to break up overly long package bodies (in Ada) without losing the internal variables etc.

Definitely would love to see it in PL/SQL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.