title: Oracle SELECT FOR UPDATE - Demonstration?
body: <p>I am quite not understanding the lock functionality with SELECT FOR UPDATE.</p>
  
  <p>Here is what I've tried. </p>
  
  <pre><code>CREATE TABLE ACCOUNT_TAB (
    ACC_ID int NOT NULL PRIMARY KEY,
    BALANCE int NOT NULL
  );
  
  INSERT INTO ACCOUNT_TAB
  VALUES(1, 100);
  
  SELECT * FROM ACCOUNT_TAB FOR UPDATE; 
  SELECT * FROM ACCOUNT_TAB; 
  </code></pre>
  
  <p>Both SELECT will retrieve the row, but shouldn't the first query lock the row in the ACCOUNT_TAB table? </p>
  
  <p>I have read something about sessions: queries from the same session don't care about the lock. Can I somehow in a single script file demonstrate the lock function? For example, can I run two different sessions in one script so the second call will retrieve an error saying that the row is locked? </p>