How can I compile a PLSQL package
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 PACKAGETo compile only package body, we can use:
ALTER PACKAGE <package_name> COMPILE BODYIn 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.