Configure Tool -> sql plus for selected text

Daniele

Member³
Hello,
you can run sql plus passing the selected text as a parameter?
Now the only way to run sql plus is saving the file and passing it in the variable #path
(ex: #wusername/#wpassword@#wdatabase @#path)

There is a variable to pass the selected text(like #selected)?
 
If you are asking about Oracle's SQL*Plus command line tool, then you can pass SQL query as standard input, eg. (on Windows):

Code:
echo select * from dual; | sqlplus username/password@db_name
 
No, I'm talking about the Tools Configuration of PL/SQL Developer:
Image (need gmail account logged in)

I did not understand what the command that you have proposed for the command line tool should do and I did not understand where I should insert this command. But surely it is not the configuration of the Configure Tool for sql plus.
Are you talking about Command Window?
 
Last edited:
In the Command Window you can use the SQLPLUS command. It passes the contents of the current file (the "Editor" tab page) to SQL*Plus, using the current connection.
 
My mistake. Some topics on this forum are not related to AllroundAutomations PL/SQL Developer (despite the fact that this forum is dedicated for that) and I figured that this one is one of those.

What I gave you is a method to pass SQL query from Windows command line do SQL*Plus application. As far as I know, there's no method of passing SQL or commands to it other than using standard input stream - there's no execution parameter of "sqlplus.exe" that could handle that.

What this means is that even if PL/SQL Developer had a Tools Configuration parameter to pass SQL from it's window to an external application (as far as I know it does not), you would have no way to use it with "sqlplus.exe" only - you'd have to use some dedicated application or script that would take SQL as an execution parameter, launch "sqlplus.exe" and pass the SQL on it's standard input stream.

The working (and much simpler) method is to use it as you did on the screen shot - pass path to an SQL file to "sqlplus.exe". What you could also do (and maybe already did) is to tick those options (on "Options" tab):
- "Save Window" (which would ensure that window content is saved to file before the file is passed to "sqlplus.exe"),
- "Active Connection" (which would make sure that there is user name, password and database to pass to "sqlplus.exe"),
- "Program Window", "SQL Window" and "Command Window" (to make sure that the tool is not available for "Test Window" and "Report Window" which produce a file that is not a valid SQL*Plus script file).
I'd also use "#dir" as "Default Path" (on "General" tab) to make sure that any SQL*Plus output spooled to files will not go to Oracle Client or PL/SQL Developer or system folders. And "#wconnect" as first execution parameter (in "Parameters" on "General" tab) instead of "#wusername/#wpassword@#wdatabase" as "#wconnect" would probably do proper escaping of special characters (as "/" in user name or "@" in password) which is not done in "#wusername", "#wpassword" and "#wdatabase".
 

Marco Kalter said:
In the Command Window you can use the SQLPLUS command. It passes the contents of the current file (the "Editor" tab page) to SQL*Plus, using the current connection.

Have you noticed that the command window is much slower than the same execution launched with sql plus?
I have some wrong configuration or is it always so?

Thanks
 
Last edited:
According to the manual, the SQLPLUS command invokes SQL*Plus with the current file, not the current "Editor" tab contents (this may differ if you change something and do not save it).
This means that it works just as the tool that Daniele has configured and not as she asked (to pass current window content without need to save it as a file). It also has the limitation to only Command Window.

I'd like to make a feature request to add a function to PL/SQL Developer, called for example "Execute in SQL*Plus", that would allow executing SQL*Plus application (from currently selected Oracle Client) with the connection credentials from current window of PL/SQL Developer that would pass selected text from current window (or whole window contents if no text is selected) to SQL*Plus standard input. There could be some configuration options like to send only current statement from current window if no text is selected and if the "Execute in SQL*Plus" function is invoked from Command Window, if PL/SQL Developer should also pass all the current environment configuration of the Command Window to the SQL*Plus prior to passing the script (eg. "set serveroutput ...", etc.).
 
Hilarion said:
I'd like to make a feature request to add a function to PL/SQL Developer, called for example "Execute in SQL*Plus", that would allow executing SQL*Plus application (from currently selected Oracle Client) with the connection credentials from current window of PL/SQL Developer that would pass selected text from current window (or whole window contents if no text is selected) to SQL*Plus standard input.

I'm also very interested in such a feature, as some scripts doesn't have the same behavior if they are executed in a Command Window or in SQL*Plus.
Example : "SET SQLTERMINATOR ON/OFF" seem to have no effect in a Command Window but is needed in SQL*Plus when you have an ";" inside an SQL statement.
This lead to errors at release process which cannot be be seen before from within PL/SQL Developer.
 
Back
Top