title: Oracle function and query return different results
body: <p>I am using oracle 10g database.</p>
  
  <p>Function is :</p>
  
  <pre><code>create or replace FUNCTION FUNC_FAAL(myCode number,firstDate date
    , secondDate date) 
    RETURN INTEGER as
    rtr integer;
  BEGIN
    select count(*) into rtr 
    from my_table tbl where tbl.myDateColumn between firstDate and 
            secondDate and tbl.kkct is null and tbl.myNumberColumn  = myCode ;
    return (rtr);
  END FUNC_FAAL;
  </code></pre>
  
  <p>This function returns 117177 as result.</p>
  
  <p>But if I run same query in the function seperately ;</p>
  
  <pre><code>select count(*)
  from my_table tbl 
  where tbl.myDateColumn between firstDate and secondDate 
  and tbl.kkct is null and tbl.myNumberColumn  = myCode ;
  </code></pre>
  
  <p>I get different result 11344 (which is the right one).</p>
  
  <p>What can be the problem ?</p>
  
  <p>Thanks.</p>