Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

How can I compile a PLSQL package

Writer Sophia Terry

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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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.