Dual-session mode and alter session

MjH

Member²
Is there a way to do an 'alter session set current_schema' command and have both sessions be affected by the command when running in Dual Session Mode?

If you issue the command, it appears to affect all the windows except the Browser (which I assume is running in the "other" session).

Thanks
 
The secondary session is indeed used for SQL Windows, Test Windows, Report Windows, and Command Windows. The primary session is used for all other things (which might otherwise implicitly commit a transaction from the other windows). I guess you could use a Program Window to run an alter session for the primary session as a "hack".
 
I have not used the Program Window before, but it looks like "execute" in that window just compiles the code, it does not execute it. How do you run something from the Program Window?

Would it be possible to create a plug-in that would prompt for the schema name and then execute the alter session command in both connections?

Thanks
 
I have not used the Program Window before, but it looks like "execute" in that window just compiles the code, it does not execute it. How do you run something from the Program Window?
Most windows just execute what you enter. In the Program Window this is typically a CREATE OR REPLACE statement. It can also execute an alter session statement though.
Would it be possible to create a plug-in that would prompt for the schema name and then execute the alter session command in both connections?
That is not possible at the moment. This can only be implemented in the AfterConnect.sql script in the PL/SQL Developer installation directory. This script runs for every session that is created. It is not dynamic though, and will not ask for a schema name.
 
Marco:

I apologize for resurrecting a very old thread, but is this supported now in 9.0.3? I just tried it, and it appears to be working. If I execute the 'alter session current_schema=' command in either a Command or SQL window, it appears to affect all other windows in that PL/SQL Developer instance.

The one exception I found was with the Test Window. If you run the code with the "Execute" command from the main toolbar, the results of the alter session command is maintained. If you run the code with the "Start Debugger" command from the Test Script tab toolbar, then the default schema reverts back to the login account (for all windows).

Thanks,
 
I don't think anything has changed. In Dual Session mode all windows share the same session, so an "alter session" statement in Window A will indeed affect the session in Window B.
 
Marco, thanks again.

Would it be possible to make an enhancement request to add support for performing 'alter session set current_user' in one window (or from a menu choice, or the toolbar, etc.) and have it affect all current and future windows/sessions (of all types) in that PL/SQL Developer instance?

 
Back
Top