Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Assuming you are actually connecting to the same database this is caused by not committing the <code>INSERT</code> in the sql*plus connection.</p> <p>Oracle by default does <strong>not</strong> run in auto-commit mode when connecting via OCI (which sql*plus uses to connect). Any <a href="https://en.wikipedia.org/wiki/Data_Manipulation_Language" rel="nofollow">DML</a>(<code>INSERT ...</code>) executed in sql*plus will not be visible to any other session until it is committed. This is because Oracle provides a <a href="https://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Read_committed" rel="nofollow">read committed</a> isolation level by default. The only thing visible to other users across sessions are write locks.</p> <p>It doesn't matter if you connect the second connection via JDBC or OCI, it won't see the changes till you commit the first connection. </p> <hr> <p>To test this out try opening 2 sql*plus connections and run the following:</p> <pre><code>-- Executing DDL in Oracle causes an implicit commit before and after the -- command so the second connection will see the existence of this table: CREATE TABLE foobar ( x VARCHAR(1) ); </code></pre> <p>Execute this in connection #1 - you should get zero (we haven't inserted anything yet):</p> <pre><code>SELECT COUNT(*) FROM foobar; </code></pre> <p>Execute this in connection #2:</p> <pre><code>INSERT INTO foobar ( x ) VALUES ( 'A' ); </code></pre> <p>Execute this in connection #1 - you should still get zero (<code>INSERT</code> is not committed so connection #1 cannot see it):</p> <pre><code>SELECT COUNT(*) FROM foobar; </code></pre> <p>Execute this in connection #2:</p> <pre><code>COMMIT; </code></pre> <p>Execute this in connection #1 - you should get 1 (it's committed now):</p> <pre><code>SELECT COUNT(*) FROM foobar; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload