title: EXECUTE IMMEDIATE statement for table creation doesn't work
body: <p>I have to write a stored procedure that creates a table which is used to record the type and X and Y coordinates of a tree. I understand you must use the EXECUTE IMMEDIATE statement in order to create the table Here's the code:</p>
  
  <pre><code>Create or replace Procedure add_populate_trees 
  (p_treenum in NUMBER)
  IS
  v_loop_counter NUMBER := 0;
  v_artari_counter NUMBER :=0;
  v_mesteceni_counter NUMBER :=0;
  v_fagi_counter NUMBER :=0;
  v_arini_counter NUMBER :=0;
  v_stejari_counter NUMBER :=0;
  BEGIN
  EXECUTE IMMEDIATE 'drop table copaci';
  EXECUTE IMMEDIATE 'create table copaci (Tip_copac VARCHAR2(25), Coord_X NUMBER(5), Coord_Y NUMBER(5))';
  WHILE v_loop_counter &lt;= p_treenum LOOP
      INSERT INTO copaci (Tip_copac, Coord_X, Coord_Y) Values('Artar',DBMS_RANDOM.value(0,1000000),DBMS_RANDOM.value(0,1000000));
      v_artari_counter := v_artari_counter + 1;
      v_loop_counter :=v_loop_counter + 1;
  INSERT INTO copaci (Tip_copac, Coord_X, Coord_Y) Values('Mesteacan',DBMS_RANDOM.value(0,1000),DBMS_RANDOM.value(0,1000));
      v_mesteceni_counter := v_mesteceni_counter + 1;
      v_loop_counter := v_loop_counter + 1;
  
  
      INSERT INTO copaci (Tip_copac, Coord_X, Coord_Y) Values('Fag',DBMS_RANDOM.value(0,1000),DBMS_RANDOM.value(0,1000));
      v_fagi_counter := v_fagi_counter + 1;
      v_loop_counter := v_loop_counter + 1;
  
  
      INSERT INTO copaci (Tip_copac, Coord_X, Coord_Y) Values('Arin',DBMS_RANDOM.value(0,1000),DBMS_RANDOM.value(0,1000));
      v_arini_counter := v_arini_counter + 1;
      v_loop_counter := v_loop_counter + 1;
  
  
      INSERT INTO copaci (Tip_copac, Coord_X, Coord_Y) Values('Stejar',DBMS_RANDOM.value(0,1000),DBMS_RANDOM.value(0,1000));
      v_stejari_counter := v_stejari_counter + 1;
      v_loop_counter := v_loop_counter + 1;
  END LOOP;
  DBMS_OUTPUT.PUT_LINE('In padure au fost plantati '||v_artari_counter||'artari');
  DBMS_OUTPUT.PUT_LINE('In padure au fost plantati '||v_mesteceni_counter||'mesteceni');
  DBMS_OUTPUT.PUT_LINE('In padure au fost plantati '||v_fagi_counter||'fagi');
  DBMS_OUTPUT.PUT_LINE('In padure au fost plantati '||v_arini_counter||'arini');
  DBMS_OUTPUT.PUT_LINE('In padure au fost plantati '||v_stejari_counter||'stejari');
  end;
  </code></pre>
  
  <p>Followed by similar inserts and variable increment, however when I execute this I get the error for the insert that the table does not exist, which can only mean the table was not created. Thanks in advance for any help</p>