Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to compile package in sqlplus using alter package?


Asked by Andrea Peters on Dec 09, 2021 FAQ



Compile package in sqlplus. Compile package header and body with following two statements. alter package my_package compile package; alter package my_package compile body; Then check, are there any invalid objects. select object_name from user_objects where status='INVALID'; If there is error, show it with following statement.
And,
The process of compiling a package body is the same as compiling a package specification. From PL/SQL Developer, you click the Run Script button to compile the package body. If you use SQL*Plus for compiling and creating a package body, you type forward slash (/) as follows:
Accordingly, Because all objects in a package are stored as a unit, the ALTER PACKAGE statement recompiles all package objects together. You cannot use the ALTER PROCEDURE statement or ALTER FUNCTION statement to recompile individually a procedure or function that is part of a package.
In fact,
You can see the associated compiler error messages with the SQL*Plus command SHOW ERRORS. Specify SPECIFICATION to recompile only the package specification, regardless of whether it is invalid. You might want to recompile a package specification to check for compilation errors after modifying the specification.
Subsequently,
Use the ALTER PROCEDURE or ALTER PACKAGE command to recompile the procedure or the entire package. Drop the procedure and create it again. Use CREATE OR REPLACE to recompile the procedure. Run one of the SQL*Plus scripts that sets up a set of Oracle-supplied packages.