Query correctly to execute creation or modification of Oracle package?

David R.

Member
Hello,
I wanted to know what is the correct way to create or modify a Package, from a user file. The previous thing because only when executing (F8), this is modified, but body remains with compilation errors which are not informed after the execution.
 
The correct syntax to create or modify a package body is:

Code:
create or replace package body <name> is
  <code>
end;

If the package body has errors that are not displayed after compilation, can you show me the "create or replace" statement line you are using?
 
Thank you Marco, for the prompt response. it is the same syntax occupied in the Packets sent by users.

create or replace the package is

END;

end ;
/

The steps usually carried out by the packages are copied and pasted in Command Window, then execute (F8) and wait for the term. During this process no errors are displayed.

Then to verify, I must open in the objection window the Package and the body of the package, just there I can see if there are errors.

Thank you please confirm if these are the recommended steps.
 
In the command window, you can type "SHOW ERRORS" to list the errors.

A better way is to paste it or open the file into a program window. It will show you the errors when compiled and then take you to the line in question when you click the error.

PL/SQL Developer has different windows specialized for different things.
 
Last edited:
Hello, in review of the steps in the Program, SQL and Commands windows, only the Execute (F8) option is given, since the Commit and Rollback buttons do not appear. I have the version PL / SQL Developer Version 12.0.6.1832 (64 bit)
with Windows 7 Build 7601 (Service Pack 1).
 
What I've often seen is PL/SQL code saved to a file with a generic .sql extension. Then when you open it in PL/SQL Developer it loads it into a SQL Window, which doesn't display compilation errors (quite rightly, as it's not designed to - the Program Window is provided for this). I would insist that my project adopts a sensible standard for naming source files, as they would for any other programming language.
 
Thank you for your observations William, it is for the same reason that I seek to know what is the correct execution of creation and modification of Package, according to file delivered by user.
 
I don't know who these users are, why they are sending you code or what your role is, but let's assume the users are developers and your job involves applying patches to controlled environments that they don't have access to themselves.

Ideally they should send a link to the source code in svn, git or whatever you use, together with a version number (or else you could make a note of the version, or the developers could use version tags to embed the version information within the source code as a header comment). Whatever your deployment system, it should be possible to find out later exactly what was deployed.

Then you could open this file (or copy & paste if you really have to I suppose) into a Program window, which provides a full-featured code editor complete with a navigator panel and detailed compilation errors.
 
Thank you very much William, when opening it with the Programs window, Package option, likewise you have to compile the body separately, not as in OSD or TOAD, but the important thing is that it works.
 
You can open a Package window (File\New\Program Window\Package) which opens a pair of windows (1 for the spec, 1 for the body), paste the package spec code into the spec window and the package body code into the body window. Then compiling (F8) will compile both at the same time.
 
Back
Top