title: Oracle using variable in where like
body: <p>I'm trying to run SQL in a PL/SQL procedure.  If I were to say:</p>
  
  <pre><code>SELECT * FROM myTable WHERE FNAME like 'Joe%' AND dept = 'xyz';
  </code></pre>
  
  <p>this runs instantly.</p>
  
  <p>if I try putting 'Joe' in a variable it takes forever to run, about 3 minutes. Here is some syntax I found for using like with variables.</p>
  
  <pre><code>PROCEDURE myProcedure(firstName IN VARCHAR,
                        cEmployees OUT cursor_type)
  IS
  BEGIN
       OPEN cEmployees FOR
       SELECT * FROM myTable WHERE FNAME like firstName || '%' AND dept = 'xyz';
  END myProcedure;
  </code></pre>
  
  <p>what am I doing wrong?  thanks.</p>