title: AMAZON 500310: Invalid operation: syntax error at or near " Drop"
body: <p>I followed <a href="https://dwgeek.com/redshift-stored-procedure-return-result-set-working-example.html/" rel="nofollow noreferrer">https://dwgeek.com/redshift-stored-procedure-return-result-set-working-example.html/</a> step of creating a stored procedure using a temporary table but facing the error above.</p>
  <pre><code>CREATE OR REPLACE PROCEDURE sample_return_table(tmp_table INOUT varchar(256)) 
  AS '
    DECLARE
      row record;
    BEGIN
     EXECUTE ' DROP table if exists ' || tmp_table;
     EXECUTE ' CREATE temp TABLE  ' || tmp_table ||  ' AS SELECT DISTINCT table_schema FROM information_schema.tables ';
    END;
  '
  LANGUAGE plpgsql;
  </code></pre>
  <p>Error:</p>
  <pre><code>[Amazon](500310) Invalid operation: syntax error at or near &quot;DROP&quot; 
  Position: 132; [SQL State=42601, DB Errorcode=500310]
  1 statement failed.
  </code></pre>
  <p>May I know what is the issue ?</p>