title: Processing aborted due to error Snowflake
body: <p>I've encountered this error:</p>
  <blockquote>
  <p>Execution error in stored procedure: SQL execution internal error: Processing aborted due to error at Snowflake.execute</p>
  </blockquote>
  <p>when running this script:</p>
  <pre><code>CREATE OR REPLACE PROCEDURE DATES_TABLE (INITIALDATE VARCHAR, FINALDATE VARCHAR)
    RETURNS VARCHAR
    LANGUAGE JAVASCRIPT
    EXECUTE AS CALLER
  AS 
  $$
              var DATESDIFF = (Date.parse(formatDate(FINALDATE)) - Date.parse(formatDate(INITIALDATE)))/ (1000 * 3600 * 24);
              
              snowflake.execute(
              
              {
              
                  sqlText: `  CREATE OR REPLACE TEMPORARY TABLE TEMP_DATE_RANGE AS SELECT DATE FROM (
                              SELECT
                                  CAST(DATEADD (DAY, DatesDiff.n, :1) AS DATE) AS DATE
                              FROM (
                                  SELECT
                                      ROW_NUMBER() OVER (ORDER BY 1) - 1
                                  FROM
                                      TABLE (generator (rowcount =&gt; :3))) DatesDiff (n)
                              ); `,
                              
                      binds: [formatDate(INITIALDATE), formatDate(FINALDATE), DATESDIFF]
  
                      }
              
              ); 
      
      
          function formatDate(date) {
              var d = new Date(date),
                  month = '' + (d.getMonth() + 1),
                  day = '' + d.getDate(),
                  year = d.getFullYear();
  
              if (month.length &lt; 2) 
                  month = '0' + month;
              if (day.length &lt; 2) 
                  day = '0' + day;
  
              return [year, month, day].join('-');
          }
  
  $$
  ;
  
  CALL DATES_TABLE('2021-04-01','2021-05-24');
  
  </code></pre>
  <p>Which when ran outside of the stored procedure, creates a table with dates between the range inputted.</p>
  <p>Any idea why this is happening, how to sort it out?</p>