Reputation: 41
myScript.sql contains package spec and body with "/" after each as:
CREATE OR UPDATE PACKAGE myPackage AS
...
END myPackage;
/
CREATE OR UPDATE PACKAGE BODY myPackage AS
...
END myPackage;
/
If I open myScript.sql and Use the "Run Script (F5)" option:
In the Script Output I see the package compiles successfully with:
Package myPackage compiled
Package Body myPackage compiled
If I open myScript.sql and use the "Execute All (Ctrl+R)" option:
In the script results I see the package fails to compile with:
ORA-24344: success with compilation error
PACKAGE created.
Commit complete.
And in the problems tab I see PLS-00103: Encountered the symbol "/"
UPDATE: After the compilation fails I opened the package spec from the database and can see the ENTIRE package body is being included... (this does not occur when the same file is run from SQL Developer)
I think this is because plsql is expecting the body and the spec to be defined in different queries... it seems "/" is somewhat of an end-of-file symbol meant to separate calls somehow...
According this page from oracle it seems the slash is a command that actually executes what's currently in the SQL buffer.
I'm not sure why the Oracle Dev Tools extension is interpreting the "/" symbol differently than SQL Developer but it's a pretty major blocker as the usage is common practice throughout my team's codebase.
As MT0 pointed out this symbol isn't an end-of-file symbol but instead it is a BLOCK terminator as mentioned here and here...
After some trial and error I was able to get the script to compile by adding the following line to the top of the file.
SET BLOCKTERMINATOR /
Still need to research how safe this change is and also how to set it on launch but at least it's a start...
Upvotes: 1
Views: 196
Reputation: 41
After significantly more troubleshooting I found I had misdiagnosed the issue entirely... by default the block terminator "/" was functioning properly however single quotes within these blocks were failing
This works:
SELECT * FROM DUAL -- '
This works:
SELECT * FROM DUAL -- ''
/
This doesn't:
SELECT * FROM DUAL -- '
/
I've submitted a new question with this information here: VS Code - Oracle Dev Tools: Single quote in comments break block terminator symbol "/" (slash)
Upvotes: 1