Code mistaken as SUBSTITUTION VARIABLE causes COMPILE Errors

sturgel

Member
Hi There,

How do you prevent PL/SQL code from being mistaken for substitution variables in the SQL Window?

It is causing a real headache for compiling code since the code is being replaced with nothing if you click Ok on the popup variable window. The code does not have any substitution variables in it but PL/SQL Developer is interpreting the code as a substitution variable! Thus causing the code to incorrectly compile!

This becomes a huge problem when you have embedded JavaScript/JQuery/Bootstrap code. Some of this code is very difficult to escape the & ampersand character without messing up the code.
 
Why are you compiling PL/SQL code in the SQL window? Anyway there is a variable substitution toggle at the bottom of the window (it's an ampersand symbol). Unless you mean something else.
 
Thanks William!
Sorry I did not know that was there!

Our code is stored as .SQL files and only the SQL Window sees the files to open quicker. I didn't realise the windows are that segregated. Whats the benefits of the program window?
 
The biggest advantage for me is code completion which won't work in SQL window.
When using the "Compile current" plug-in you can only compile the package body which avoids invalid objects.
And not to forget - the "show content" navigator pane.
 
Last edited:
The Program window shows compilation errors, which the SQL window does not!

Also the Program window gives you a code contents navigator pane, and 'Refactoring' and 'Compare to' right-click options.
 
Just to add - as you are finding out,

sturgel said:
Our code is stored as .SQL files
That is the wrong file extension for PL/SQL source code.

Other languages like Java and C have strongly defined conventions (you wouldn't save a C header file with a .c extension or a Java class file as .java, as it would obviously break standard tools and confuse developers. As PL/SQL compiles in the database rather than on the OS, it matters less what convention you use, but you should still use one that allows tools to work as intended.
 
Back
Top