title: 100132 (P0000): JavaScript execution error: Uncaught ReferenceError:
body: <p>I am practicing use cases of try and catch for stored procedure Getting error num is not defined. But getting below complete error.</p>
  
  <pre><code>100132 (P0000): JavaScript execution error: Uncaught ReferenceError: num is not defined in SP at '    var sql_comm = "insert into test_sp (col) values(" + num + ")";' position 57
  </code></pre>
  
  <p>stackstrace:
  SP line: 2</p>
  
  <p>Below is my code</p>
  
  <pre><code>    create or replace TABLE TEST_SP (
         COL NUMBER(38,0)                                                                       
   );
  
  create or replace procedure sp ( num float )
      returns float
      language javascript
      strict
      execute as owner
      as
      $$
      var sql_comm = "insert into test_sp values(" + num + ")";
      try {
              snowflake.execute(
                      {sqlText:sql_comm}
                  );
              return "succeeded"
      }
      catch (err){
          return "failed" + err ;
      }
      $$
      ;
  
      call sp(2::float);
  </code></pre>