title: parameter view in teradata
body: <p>I want to pass some variable in query and need to use result set in reporting tool like spotfire.</p>
  
  <pre><code>select prod_id,sum(sal)
  from cal c
  where qtr_num in (:q)
  group by 1
  having sum(sal)&gt;0;
  </code></pre>
  
  <p>:q can be single value('Q1') or multiple values('Q1','Q2','Q3','Q4') as well.</p>
  
  <p>I know we can use macro as parameter view. but we can not use result set returned by that macro in select part/reporting tool.</p>
  
  <p>other option is to create view without filter and then use that view with parameter filter.</p>
  
  <pre><code>create view v 
  as
  (select prod_id,sum(sal)
  from cal c
  group by 1
  having sum(sal)&gt;0);
  
     select *
     from v
     where qtr_num in (:q);
  </code></pre>
  
  <p>but this approach may skip partition access(created on qtr_num) and inefficient way to query in my opinion. This query is just for demonstrate purpose. actual query is much more complex than this.</p>
  
  <p>Is there any way to achieve this in teradata? </p>