Question

Asked on 2006-12-01 at 10:51:34ID: 25474010

Query to fetch records between 2 dates

by: Ramana99250

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. 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?
  2. to_char with date data type
    I am trying to do this: select to_char('2005-04-26 06:00:00','yyyy-mm-dd hh:mi:ss AM') from dual It gives an 'Invalid number error', ORA-01722 However, if I do this: select to_char(sysdate,'yyyy-mm-dd hh:mi:ss AM') from dual it works. Any ideas?
  3. Is it possible to pull a date field that was entered …
    Im stil trying to get this query to work the way I want I have a table of customers I am entering the date using this Entry_Date DATE default sysdate NOT NULL I was trying to query the first 10 entries and have the date return in the format below so this would return the date the record was entered in the format I am asking for below…
  4. how to change date format when loading data fr…
    Hi all, I am migrating form red brick database to oracle. The flat files are available on sql server. so i have to basically load data from flat files on sql server into external tables and merge it the existing tables on oracle. On red brick the timestamp is 'mm/dd/yyy hh:mi;ss am/pm' in flat file it is recorded as 'yyyy-mm-dd hh24:mi:…
  5. Joining the result of Aggregate function with a qu…
    Currently, I have a query like this: with data as( select o.id, o.created created, o.care, l.created lcreated, o.electronic, l.orderid lorderid, l.stateid , l.userid, r.id rid, r.orderid rorderid, r.created response, r.responsetypeid, rs.id rsid from orders o, logs l, responses r, responsetypes rs where o.id = R…

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

Posted on 2006-12-01 at 10:55:50ID: 28322243

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

Posted on 2006-12-01 at 10:59:57ID: 28322244

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

Posted on 2006-12-01 at 11:08:21ID: 28322245

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

Posted on 2006-12-01 at 11:27:47ID: 28322246

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

Posted on 2006-12-01 at 11:31:16ID: 28322247

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

Posted on 2006-12-01 at 11:58:32ID: 28322248

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

Posted on 2006-12-01 at 12:01:12ID: 28322249

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

Posted on 2006-12-01 at 12:30:00ID: 28322250

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:

Posted on 2006-12-01 at 12:55:15ID: 28322251

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

Posted on 2006-12-04 at 01:52:44ID: 28322252

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