title: Executing part of stored procedure based on condition
body: <p>I am trying to load to a table based on load types - Full or Incremental that is being passed as parameter in stored procedure. I was able to try with substitution variable with one line of code previously, but the below code doesn't seem to work -</p>
  <pre><code>Stored procedure possible arguments:
  
  LOAD_TYPE=FULL
  LOAD_TYPE=INCR
  
  var incr_condition = (load_type=='INCR')?&quot;INNER JOIN temp_table&quot;
  
  with temp_table(
  select data
  from table a
  where dt between 01-01-2019 and 09-09-2020
  )
  
  select *
  from table b
  ${incr_condition} -- execute only if load_type=INCR
  INNER JOIN TABLE C ON B.ID = C.ID
  </code></pre>
  <p>Is there any way to restrict the with clause to execute only if the load_type==INCR? Please advice.</p>