How to choose results between two dates or one year / month / day in oracle? (to_date, extract, sysdate)

I have a table for orders, and it has 2 columns with DATE types: delivery_date and order_date. In my sqldeveloper, all dates that I inserted through Java or manually are in the format 10.01.25 for January 25 of this year. When I try to see total_price for orders between one date and another, I can format this format:

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;

but I return -1. I'm even trying to make a query like this: select f.total_enc_fornec from fornecimento f where f.data_entrega = '10.01.24';
like this: select f.total_enc_fornec from fornecimento f where f.data_entrega = to_date('10.01.24','yy-mm-dd');
for example: select f.total_enc_fornec from fornecimento f where f.data_entrega < to_date('10.01.24');and NOTHING is back! but if I execute:, select f.total_enc_fornec from fornecimento f where f.data_entrega <= sysdate;it prints the result, which should ...

How can i do this? I am clearly not passing parameters or function correctly without executing the request itself

Btw, //? , , extract. , ? , , , , lol.

+3
1

DATE Oracle + , , f.data_entrega = '10.01.24', , f.data_entrega - 10.01.24 6 . , SYSDATE , .

, (.. ), :

select f.total_enc_fornec into v_total_enc
from fornecimento f
where f.data_entrega between TRUNC(init_date) and TRUNC(final_date) + 0.99999;
+3

Source: https://habr.com/ru/post/1729866/


All Articles