Search code examples
oracle-databasetransactionsplsqldeveloper

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? (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). If this understanding is correct, what is the utility of that given that the two transactions share a single connection?


Solution

  • 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.