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

  • SEARCH
  • Home
  • 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 8402347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:01:58+00:00 2026-06-09T22:01:58+00:00

I have an oracle DATE column and the value of a particular record for

  • 0

I have an oracle DATE column and the value of a particular record for the column is

16/10/2005 11:13:34 AM.

Now I am putting in a filter like this where the filter string is passed in from the front end.

date_col between to_date('16-10-2005','DD-MM-YYYY') and to_date('16-10-2005','DD-MM-YYYY') 

It returns zero records. Why is this happening? I was thinking oracle would return all records that have a date of 16/10/2005 irrespective of the time.
Do i need to pass in thetime also/From the front end, I only get date and not time.

  • 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-06-09T22:01:59+00:00Added an answer on June 9, 2026 at 10:01 pm
    date_col between to_date('16-10-2005','DD-MM-YYYY') 
         and to_date('16-10-2005','DD-MM-YYYY') 
    

    will only return DATE values of midnight on October 16, 2005. If you want to fetch data for any time on October 16, 2005

    date_col between to_date('16-10-2005','DD-MM-YYYY') 
                 and to_date('16-10-2005 23:59:59','DD-MM-YYYY HH24:MI:SS') 
    

    will do it. So would

    date_col between to_date('16-10-2005','DD-MM-YYYY') 
                 and to_date('17-10-2005','DD-MM-YYYY') - interval '1' second
    

    If you fail to subtract that second, you’ll also end up pulling rows that have a date_col value of midnight on October 17, 2005.

    You could also apply a trunc function to your date_col

    trunc(date_col) = date '2005-10-16'
    

    but that would prevent a standard index on date_col from being used. You would generally need to create a function-based index on trunc(date_col)

    CREATE INDEX idx_trunc_date_col
        ON table_name( trunc(date_col) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Oracle Date column in a db table, and fetching this field
I have an Oracle DATE column with, for example, these values: RUN_DATE ------------------- 2012-06-09
I have a table with a DATE column with time (as usual in Oracle
I have got a column of type DATE in my Oracle DB. 06.09.12 is
I have a table in Oracle called quotes with two columns: date and value
In oracle, is the named timezone always stored? I have been testing this column
I have an Oracle Date type to which I need to insert the current
I have a table in an Oracle Database that has, among others, a DATE
We have Oracle Server Oracle Version: 10.2.0.4.0 - 64bit. I like to connect to
I have a oracle table A which contains a column A.a which used to

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.