• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

problem related to timestamp

 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using Oracle DB. I have one table which has one column with data type as timestamp. e.g data for this column is "26-FEB-08 11.58.38.712000000 AM".

Now I want to fetch all records created on the particular date. So I am writing query like "Select * from TABLE_XYZ where date like '26-FEB-08'", but its not fetching the records.

Solution to this problem is fetch data between two dates like "Select * from TABLE_XYZ where date between '26-FEB-08' and '27-FEB-08'".

Is there any functions that I can use, which will get me the records of the particular date, by which I can get results without using 'between'.
Problem with second approach, I need to take care of invalid dates.

Please Help me in this issue.

Thanks,
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is there any functions that I can use, which will get me the records of the particular date, by which I can get results without using 'between'.

Yes, but it might be slower: select x, y from TABLE_XYZ where trunc(date) = '26-FEB-08'.

If you have an index on the date colum, then your between solution could be faster.

Regards, Jan
 
Anand Loni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jan
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic