00900. 00000 - "invalid SQL statement" for EXECUTE IMMEDIATE
<p>I am trying to use Dynamic query in my code below but getting error (00900. 00000 -  "invalid SQL statement"). Kindly suggest where i am mistaking in the code.</p>

<pre><code>create or replace PROCEDURE CreateInsertTmpTable
AS
crttmp VARCHAR2(200);
intrtmp VARCHAR2(200);
printTableValues VARCHAR2(1000);

BEGIN
  crttmp := 'CREATE GLOBAL TEMPORARY TABLE my_temp_table ON COMMIT PRESERVE ROWS AS SELECT * FROM VWBLKDATA WHERE 1=0';
  EXECUTE IMMEDIATE crttmp;
  intrtmp := 'INSERT INTO my_temp_table SELECT * FROM VWBLKDATA';
  EXECUTE IMMEDIATE intrtmp;
  printTableValues := ' for data in(SELECT * from my_temp_table)
                        loop
                             dbms_output.put_line(data.ID); 
                        end loop';
  EXECUTE IMMEDIATE printTableValues;
  COMMIT;
END CreateInsertTmpTable;
</code></pre>