title: Stored procedure handling multiple SQL statements in Snowflake
body: <p>I'm creating a stored procedure in Snowflake that will eventually be called by a task.</p>
  <p>However I'm getting the following error:</p>
  <blockquote>
  <p>Multiple SQL statements in a single API call are not supported; use one API call per statement instead</p>
  </blockquote>
  <p>And not sure how approach the advised solution within my Javascript implementation.</p>
  <p>Here's what I have</p>
  <pre><code>CREATE OR REPLACE PROCEDURE myStoreProcName()
  RETURNS VARCHAR
  LANGUAGE javascript
  AS
  $$
  var rs = snowflake.execute( { sqlText: 
  `set curr_date = '2015-01-01'; 
  
  
  CREATE OR REPLACE TABLE myTableName AS 
  
  
  with cte1 as (
  SELECT
    * 
  FROM Table1
  where date = $curr_date
  )
  ,cte2 as (
  SELECT
    * 
  FROM Table2
  where date = $curr_date
  )
  
  select * from
  cte1 as 1 
  inner join cte2 as 2
  on(1.key = 2.key)
  
  `
    
     } );
  return 'Done.';
  $$;
  </code></pre>