title: Using cursor parameter results in a different execution plan?
body: <p>For some reason I'm trying to figure out why the following query executes by full table scan which takes ages because the table has ~31M rows</p>
  
  <pre><code>PROCEDURE d1(k_uni_in IN data_par.k_uni%TYPE) AS
    CURSOR d1_cur IS
    SELECT d.*
    FROM data_par d
    WHERE d.k_uni = k_uni_in
    ORDER BY d.k_date;
  BEGIN
    FOR i IN d1_cur LOOP
      ...
    END LOOP;
  END;
  </code></pre>
  
  <p>However seemingly similar query runs index range scan and is pretty much instant</p>
  
  <pre><code>PROCEDURE d1(k_uni_in IN data_par.k_uni%TYPE) AS
    CURSOR d1_cur(k_cv IN data_par.k_uni%TYPE) IS
    SELECT d.*
    FROM data_par d
    WHERE d.k_uni = k_cv
    ORDER BY d.k_date;
  BEGIN
    FOR i IN d1_cur(k_uni_in) LOOP
      ...
    END LOOP;
  END;
  </code></pre>
  
  <p>Why does that happen? Should I always use cursor parameters instead of using suprogram parameters in cursors?</p>