简体   繁体   English

了解PL / SQL Developer中的两个SQL窗口

[英]Understanding two SQL windows in PL/SQL Developer

Is it a correct understanding that queries run in two SQL windows in PL/SQL Developer are executed as two separate transactions? 是否正确理解将在PL / SQL Developer中的两个SQL窗口中运行的查询作为两个独立的事务执行? (I tend to conclude this based on the fact that the results of a modification query issued in one window are not reflected in the results of a SELECT query issued in another window). (我倾向于基于以下事实得出结论:在一个窗口中发出的修改查询的结果未反映在另一窗口中发出的SELECT查询的结果中)。 If this understanding is correct, what is the utility of that given that the two transactions share a single connection? 如果这种理解是正确的,那么鉴于两个事务共享一个连接,该函数的用途是什么?

Two transactions cannot share a single connection. 两个事务不能共享一个连接。 If each window is a separate transaction, each window would open a separate connection to the database. 如果每个窗口是一个单独的事务,则每个窗口将打开一个单独的数据库连接。 If you have two transactions, you have two sessions. 如果您有两个事务,则有两个会话。

If you want to see whether the different windows are using different connections, you can run 如果要查看不同的窗口是否使用不同的连接,可以运行

select sys_context( 'USERENV', 'SID' ) from dual;

If you get the same result in both windows, you have a single connection and a single transaction. 如果在两个窗口中都得到相同的结果,则您只有一个连接和一个事务。 If you get different results, you have different connections. 如果得到不同的结果,则说明您具有不同的联系。

"Session Mode" is configurable via the preference settings. 可通过首选项设置配置“会话模式”。 The default is "Multi-Session", in which each window runs in its own session. 默认值为“多会话”,其中每个窗口在其自己的会话中运行。

The other options are "Dual Session" (my preferred setting), in which all windows share one session while the schema browser, session monitor, compilations etc use a second session, or "Single Session" where the whole application uses a single session. 其他选项是“双会话”(我的首选设置),其中所有窗口共享一个会话,而模式浏览器,会话监视器,编译等使用第二个会话,或者“单个会话”,其中整个应用程序使用单个会话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM