Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 566875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:01:26+00:00 2026-05-13T13:01:26+00:00

I have a table for orders and it has 2 column with DATE types:

  • 0

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 between one date and another, I force the format like this:

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 get -1 returned. I even try to do the 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');
like this: select f.total_enc_fornec from fornecimento f where f.data_entrega < to_date('10.01.24'); and NOTHING is returned!
but if I execute : select f.total_enc_fornec from fornecimento f where f.data_entrega <= sysdate; it prints a result as it’s supposed to…

How can I do this? I’m clearly not passing correctly the parameters nor in the function, neither executing the query itself

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:01:26+00:00Added an answer on May 13, 2026 at 1:01 pm

    The Oracle DATE type stores a date+time down to the nearest second – so if you say f.data_entrega = '10.01.24' it will not match a record where f.data_entrega is 10.01.24 at 6am. SYSDATE, similarily, returns the current time as well as today’s date.

    If you want your function to match on the date portion only (i.e. ignore any time values), you may need to change the function:

    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;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that I select data from with a column called parent
I have the following tables: Orders, Notes, Permits The following columns are in each
I have 3 tables that have same columns,but different data ( deposits,withdrawals,transfers ) CREATE
I have stored procedure that returns results sorted dynamically. The parent folder (this is
I have written this function that will give me a monthly sum for two
i have the following 2 classes. class Customer < ActiveRecord::Base set_table_name customer set_primary_key customerId
I have a fairly complicated join query that I use with my database. Upon
I'm trying to determine the best general approach for querying against joined two tables
In MySQL, does putting SELECT foo increase in performance if foo is indexed? At
I'm learning SSIS and this seems like an easy task but I'm stuck. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.