How Can I Compile a Plsql Package

How do I compile oracle package in sql prompt and using toad? I googled, I got answers only for recompiling, could not find anything for how to compile.

3 Answers

Try the following

ALTER PACKAGE <your_package_name> COMPILE PACKAGE;

ALTER PACKAGE <your_package_name> COMPILE BODY;
2

To compile both package spec and package body we can try below command:

ALTER PACKAGE <package_name> COMPILE

ALTER PACKAGE <package_name> COMPILE PACKAGE

To compile only package body, we can use:

ALTER PACKAGE <package_name> COMPILE BODY

In case we are using toad, we can select our package spec or body and then use F9 key to compile either package spec or package body.

In toad, if the package does not exist yet, you've got 2 options: F5 and F9, both from the SQL window where the package's code is. F9 is more convenient about compilation errors if any (in my opinion).

You'll have to be sure package specs are compiled before the body though. It can be done in 2 separated windows or only one, it does not matter.

Your Answer

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

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest