title: How to select results between two dates or by single year/month/day in oracle? (to_date, extract,sysdate)
body: <p>I have a table for orders and it has 2 column with DATE types: delivery_date and order_date.
  In my sqldeveloper, all the dates I've inserted via Java or by hand are in the format    10.01.25 for the 25th Jan of this year. 
  When I try to see the the total_price for orders <strong>between</strong> one date and another, I force the format like this:</p>
  
  <pre><code>create or replace function calc_Outlays (init_date IN DATE,final_date IN date)return number is
  
  v_total_enc FORNECIMENTO.TOTAL_ENC_FORNEC%TYPE;
  
  begin
  select f.total_enc_fornec into v_total_enc from fornecimento f where f.data_entrega between init_date and final_date;
  return v_total_enc;
  
  Exception 
  When no_data_found then
  Insert Into errors Values (0,'No supplyment costs found for dates between '||to_char(init_date)||' and '||to_char(final_date),systimestamp);
  return -1;
  end;
  </code></pre>
  
  <p>but I get -1 returned. I even try to do the query like this: <code>select f.total_enc_fornec from fornecimento f where f.data_entrega = '10.01.24';</code><br>
  like this: <code>select f.total_enc_fornec from fornecimento f where f.data_entrega = to_date('10.01.24','yy-mm-dd');</code><br>
  like this: <code>select f.total_enc_fornec from fornecimento f where f.data_entrega &lt; to_date('10.01.24');</code> and NOTHING is returned!
  but if I execute : <code>select f.total_enc_fornec from fornecimento f where f.data_entrega &lt;= sysdate;</code> it prints a result as it's supposed to...</p>
  
  <p>How can I do this? I'm clearly not passing correctly the parameters nor in the function, neither executing the query itself</p>
  
  <p>Btw, and if I wanted to select ALL the orders of some year/month/day? Say, using  extract function for example. Could you please show me how? I've tried, but I'm having the same problems and I it's simple in concept, at least, lol.</p>