Compile: Program Window vs Command Line

Greg Pigate

Member²
We have objects that will compile in a program window but not command line. Things like comment lines after everything else in the code will compile in plsql developer but not if you compile command line.

Is there anything out there that resolves this? It is making things a little difficult for us when deverlopers check in code that compiled find for them but will not compile when we promote the code to a formal test environment.

Any help is appreciated.

Thanks

Greg Pigate
 
Sorry, I missed this. What exactly goes wrong in SQL*Plus? Perhaps you are using ampersands in the PL/SQL code which is interpreted by SQL*Plus?
 
nah its not ampersands, the latest event we saw was something along the lines of

create or replace package body blah_blah as

....
...
end blah blah;
/

/*
comment out some stuff here
*/

the comments at the bottom are ignored on plsql developer and will compile, but wont if you run from a sqlplus command line.

we also have problems if we put our spec and body in one file and put grants and syns in. Toad ignores them and allows teh code to compile but plsql develoepr comes to a screaching halt on them

any ideas on ways around it.

Thanks

Greg
 
everything is fine in plsql developer with the comments at the bottom. the error is given there when you compile it at command line. And it may be if you are using a driver script to compile more than one package.

The screaching hault comes if you have synonyms and grants in the source and you compile in the plsql dev window and do not have the permissions to do so. I can understand this happening to some extent, however if you compile command line, the source is still created, you just dont get the syns and gratns
 
All of our packages are put in the apps schema, so grants and synonyms aren't such an issue. We do have other things like set verify on and off to handle ampersands, and we are required to have "show errors" as part of the package script. Therefore, I run into some of the same issues.

I don't have any great ideas, but here is what I do.

For the package, I do this:

create or replace package package_name
...
end package_name;
/
SHOW ERRORS;
-- whatever else.

The "/" Will put the show errors, comments and whatever else in a separate tab in the program window (not when you are typing it in, but next time you open the window. If the "/ Show errors" is in a template though, it will open the first time with a separate tab and so I have it in a template).

I have the "Ignore Unrecognized PL/SQL" option checked in the program window preference. Now the package will compile within PL/SQL Developer just fine since it ignores the last tab. Grants and synonyms obviously aren't created.

One other idea for the packages. I created templates that includes all the grants and synonyms when I create tables. Once I get the template to work once, it pretty much always works so syntax errors don't happen as often. The same idea could be used for packages as well.

Before I check in the code, I run it once with SQL Plus to make sure the stuff after the package works before I check it in. We use Kintana and part of the workflow is to install it and that step is before it is checked in. So I just do that step.

I don't do it this way, but the manual shows how to use SQL Plus as one of your "user defined tools". It would then, open SQL Plus and compile the package and execute the synonyms and grants part. Just remember to save it first.

Mike
 
Back
Top