title: Snowflake Procedure Migration
body: <p>Can some one help me in guiding is this is the best way of converting an oracle procedure to snowflake via JS.</p>
  <p>Oracle Proc:</p>
  <p>PROCEDURE ABC (LOGGED_USER       IN VARCHAR,
  request_date      IN VARCHAR,
  page              IN VARCHAR,
  activity          IN VARCHAR,
  payload_request   IN VARCHAR,
  CHANGED_USER      IN VARCHAR)
  IS
  BEGIN
  INSERT INTO ABCD (LOGGED_USER,
  request_date,
  page,
  activity,
  payload_request,
  CHANGED_USER)
  VALUES (LOGGED_USER,
  TO_DATE (request_date, 'MM/DD/YYYY HH24:MI:SS'),
  page,
  activity,
  payload_request,
  CHANGED_USER);
  EXCEPTION
  WHEN OTHERS
  THEN
  INSERT INTO ABCD (LOGGED_USER,
  request_date,
  page,
  activity,
  payload_request,
  CHANGED_USER)
  VALUES (LOGGED_USER,
  '',
  page,
  activity,
  payload_request,
  CHANGED_USER);
  END ABC;</p>
  <p>Snowflake Proc</p>
  <p>create or replace procedure xxxxx ( LOGGED_USER STRING, REQUEST_DATE STRING, PAGE STRING, ACTIVITY STRING, PAYLOAD_REQUEST STRING, CHANGED_USER STRING ) language javascript as $ $ try { var query = &quot;INSERT INTO ABC (LOGGED_USER, REQUEST_DATE, PAGE, ACTIVITY, PAYLOAD_REQUEST, CHANGED_USER) VALUES ({$LOGGED_USER}, TO_DATE ({$REQUEST_DATE}, 'MM/DD/YYYY HH24:MI:SS'), {$PAGE}, {$ACTIVITY}, {$PAYLOAD_REQUEST}, {$CHANGED_USER});&quot; var sql = snowflake.createStatement({ sqlText: query }); var result = sql.execute(); } catch(error) { var query = &quot;INSERT INTO ABC (LOGGED_USER, REQUEST_DATE, PAGE, ACTIVITY, PAYLOAD_REQUEST, CHANGED_USER) VALUES ({$LOGGED_USER}, 'NULL', {$PAGE}, {$ACTIVITY}, {$PAYLOAD_REQUEST}, {$CHANGED_USER});&quot; var sql = snowflake.createStatement({ sqlText: query }); var result = sql.execute(); return error.message; } $$;</p>
  <p>Thanks ,
  Nikhil</p>