title: Is there any way to do error handling in snowflake?
body: <p>Am currently loading data from one snowflake table to another table in snowflake, also doing some datatype conversions while doing the data loads</p>
  
  <p>But when there is any error, my load is getting failed.I need to capture the error rows in a table and continue my load though any errors occur.</p>
  
  <p>I have tried that using stored procedure as below but only able to capture error information:-
  Please let me know if there is any way to achieve this in snowflake.</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE LOAD_TABLE_A() 
  RETURNS varchar 
  NOT NULL 
  LANGUAGE javascript 
  AS 
  $$
  var result;
  var sql_command = "insert into TABLE A"
   sql_command += " select"
   sql_command += " migration_status,to_date(status_date,'ddmmyyyy') as status_date,"
   sql_command += " to_time(status_time,'HH24MISS') as status_time,unique_unit_of_migration_number,reason,"
   sql_command += " to_timestamp_ntz(current_timestamp) as insert_date_time"
   sql_command += " from TABLE B"
   sql_command += " where insert_date_time&gt;(select max(insert_date_time) from TABLE A);"
  try {
      snowflake.execute({ sqlText: sql_command});
      result = "Succeeded";
  } 
  catch (err) {
      result = "Failed";
      snowflake.execute({
        sqlText: `insert into mcs_error_log VALUES (?,?,?,?)`
        ,binds: [err.code, err.state, err.message, err.stackTraceTxt]
        });
  }
  return result;
  $$;
  </code></pre>