Print Thread
Compile only SPEC or BODY in Program Window
#57021 09/11/17 10:03 PM
Joined: Sep 2017
Posts: 4
Idaho, USA
dthibi Offline OP
Member
OP Offline
Member
Joined: Sep 2017
Posts: 4
Idaho, USA
In the Program Window, is there a way to only compile the Package Spec or Package Body?

For example if I have file mypackage.pck:

SQL Query
set DEFINE OFF

create or replace package PKG_TEST is

end PKG_TEST;
/
create or replace package body PKG_TEST is

begin
  null;
end PKG_TEST;
/

SHOW ERRORS

The Program Window splits it into 3 tabs Spec, Body, and "?". When I compile I get an error because of the "SHOW ERRORS" at the end. Can I make this work?


Re: Compile only SPEC or BODY in Program Window
dthibi #57023 09/12/17 09:20 AM
Joined: Aug 1999
Posts: 22,214
Member
Offline
Member
Joined: Aug 1999
Posts: 22,214
You cannot compile just the spec or body. You would have to keep them in separate files.

To suppress the "SHOW ERRORS" SQL*Plus command, you can go to Preferences > Program Window and enable the "Ignore unrecognized PL/SQL" option.


Marco Kalter
Allround Automations
Re: Compile only SPEC or BODY in Program Window
Marco Kalter #57025 09/12/17 09:37 AM
Joined: Jul 2004
Posts: 281
The Netherlands
Member
Offline
Member
Joined: Jul 2004
Posts: 281
The Netherlands
To compile only Spec or Body you can use the 'Compile Current' plug-in from BAR Solutions (it's on the plug-in page). Works like a charm.


Been there, done that, Got the T-Shirt
Re: Compile only SPEC or BODY in Program Window
Marco van der Linden #57026 09/12/17 09:59 AM
Joined: Feb 2003
Posts: 392
The Netherlands
Member
Offline
Member
Joined: Feb 2003
Posts: 392
The Netherlands
Thanks for the plug ;-)

Re: Compile only SPEC or BODY in Program Window
patch #57029 09/12/17 04:17 PM
Joined: Sep 2017
Posts: 4
Idaho, USA
dthibi Offline OP
Member
OP Offline
Member
Joined: Sep 2017
Posts: 4
Idaho, USA
I like a combo of both solutions with some additional preference setup:

1) I downloaded plug-in "Execute Current Statement" (new name for "Compile Current"?)

2) Set the following preferences:
  • Window Types:
    • Program Window -> Ignore unrecognized PL/SQL
    • AutoSelect statement
  • User Interface -> Key Configuration
    • SQL Window: Execute current statement: Ctl+F8
    • Plug-Ins / [ExecuteCurrent] ... / Execute current statement: Alt+F8
    • Plug-Ins / [ExecuteCurrent] ... / Execute current tab: Shift+F8

I now have the following behavior:

F8: run statement under cursor in SQL Win, compile all in Pgm Win
Ctl+F8: run all in SQL Win, n/a in Pgm Win
Alt+F8: run statement under cursor in SQL Win, n/a in Pgm Win
Shift+F8: n/a in SQL Win, compile only current tab in Pgm Win

Patrick, since "Execute current statement" seems to only apply in the SQL Win and "Execute current tab" only applies in the Pgm Win, could you combine both into 1 command that takes the appropriate action for the window your in?

I tried setting both to the same hotkey and that didn't work (darn!)

Re: Compile only SPEC or BODY in Program Window
dthibi #57067 09/24/17 05:55 AM
Joined: Feb 2003
Posts: 392
The Netherlands
Member
Offline
Member
Joined: Feb 2003
Posts: 392
The Netherlands
I added a new command to the plugin to execute the current window. This executes the current statement or the current tab, depending on the windowtype.


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.052s Queries: 14 (0.019s) Memory: 2.5209 MB (Peak: 3.0395 MB) Data Comp: Off Server Time: 2024-05-10 05:36:53 UTC
Valid HTML 5 and Valid CSS