title: PL/SQL variable scope in nested blocks
body: <p>I need to run some SQL blocks to test them, is there an online app where I can insert the code and see what outcome it triggers?
  Thanks a lot!
  More specific question below:</p>
  
  <pre><code>&lt;&lt;block1&gt;&gt;
  DECLARE 
  var NUMBER;
  BEGIN
  var := 3;
  DBMS_OUTPUT.PUT_LINE(var);
  
    &lt;&lt;block2&gt;&gt;
    DECLARE 
    var NUMBER;
    BEGIN
    var := 200;
    DBMS_OUTPUT.PUT_LINE(block1.var);
    END block2;
  DBMS_OUTPUT.PUT_LINE(var);
  END block1;
  </code></pre>
  
  <p>Is the output: 
  3
  3
  200</p>
  
  <p>or is it:
  3
  3
  3
  I read that the variable's value is the value received in the most recent block so is the second answer the good one? I'd love to test these online somewhere if there is a possibility.
  Also, is <code>&lt;&lt;block2&gt;&gt;</code> really the correct way to name a block??</p>
  
  <p>Later edit:
  I tried this with SQL Fiddle, but I get a "Please build schema" error message:
  Thank you very much, Dave! Any idea why this happens? </p>
  
  <pre><code>create table log_table
  ( message varchar2(200)
  )
  
  
  &lt;&lt;block1&gt;&gt;
  DECLARE 
  var NUMBER;
  BEGIN
  var := 3;
  
  insert into log_table(message) values (var)
  select * from log_table
  
    &lt;&lt;block2&gt;&gt;
    DECLARE 
    var NUMBER;
    BEGIN
    var := 200;
    insert into log_table(message) values (block1.var || ' 2nd') 
    select * from log_table
    END block2;
  insert into log_table(message) values (var || ' 3rd') 
  select * from log_table
  END block1;
  </code></pre>