title: Query on View is running slower than direct query - in Oracle
body: <p>I tried creating view with parameters to get the data dynamically.<br>
  (I cant use WHERE condition as the select statement itself changes based on the parameters)</p>
  
  <p>For this, I wrote a procedure which returns me the required data as oracle object type.</p>
  
  <pre><code>FUNCTION get_data(p_pk_id  NUMBER, p_tab_type VARCHAR2)
  RETURN M_TYPE_DATA_TAB
  AS
  v_table_collection M_TYPE_DATA_TAB;
  BEGIN
  
  -- my sql query which will change based on the params
  
  RETURN v_table_collection;
  END;
  </code></pre>
  
  <p>and I run the select query as follows.</p>
  
  <pre><code>SELECT * FROM TABLE(get_data(12345, 'MYTAB'));
  </code></pre>
  
  <p>which gives me data in <strong>less than 1 sec</strong>.</p>
  
  <p>for the same select statement I have created a view as</p>
  
  <pre><code>CREATE OR REPLACE VIEW my_view
  AS SELECT * FROM TABLE(get_data(12345, 'MYTAB'));
  </code></pre>
  
  <p>if I query the view</p>
  
  <pre><code>SELECT * FROM my_view
  </code></pre>
  
  <p>it takes <strong>more than 6 sec</strong> to get the same data.</p>
  
  <p>Any idea why there is that much big difference to query the same data.<br>
  Will the veiw take more time than a normal query?</p>