Question

Query to fetch records between 2 dates

Rating9.0Excellent

hello,

I am trying to get records between two dates in oracle but if I use where clause I get only one record and without using where I see 1000's of them during those times which I am not getting in my results. Can you help me?

My query is:
Select * from METADATA
where to_char(EVENT_FINISH, 'dd:mm:yy hh:mi:ss') between '01:12:06 08:47:26'  and  '01:12:06 11:47:26'  
 and I also tried using where to_char(EVENT_FINISH, 'dd:mm:yy hh:mi:ss') > '01:12:06 08:47:26' and to_char(EVENT_FINISH, 'dd:mm:yy hh:mi:ss') < '01:12:06 11:47:26'


Can you help me with the appropriate query which gets me 20  records during those times?

  1. Database date and time
    Dear expert, I have developed an oracle 6i form. In that i need to set a field that shows database date with time . Like : sysdate HH:MI:SS (It should be like a clock for the user). Please help me how to create the field.
  2. How to get Oracle to use multiple date formats in …
    I am trying to manually duplicate the results of a query some software at my job runs. I have attached a sample query below. When the software runs the query it returns (desired result): '001-001-01-JAN-06-0-6-6-6','2006-01-06 00:00:00' When I run the query manually in SQLPlus I get: …
  3. oracle query
    select distinct(count (sid)),nvl(sum(amount),0),'Current Session ==> ' FROM ledger WHERE descr = 'PAYMENT RECEIVED' AND ldate BETWEEN (to_date('01-apr-'||to_char(to_number(to_char(sysdate,'YYYY'))-1),'dd-mon-yyyy')) AND LAST_DAY (ADD_MONTHS (SYSDATE, 0)) On d…
  4. Oracle query record value at specific date
    I have the following records: id price effectiveDate 1 24.00 01/01/2008 1 26.00 08/01/2008 1 28.00 10/01/2008 i need to show what the price was for item 1 on 09/01/2008. i know it would be 26.00 but how do i build a query to show only one record …
  5. Query Records where Date = 2008
    I have a table that has a column called regdate. I want to query all the users that were registered in 2008. How can I query those users based on that column regdate to only show the registered users from 2008?

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
between dates oracle query records
Participating Experts
4
Solution Grade
A

Replies

 
by: OMC2000

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: sunnypoint

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: johnsone

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: sunnypoint

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: johnsone

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Ramana99

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: sunnypoint

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Ramana99

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by:

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: divyeshhdoshi

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert