This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem related to timestamp  RSS feed

 
Anand Loni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • 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,
 
Jan Cumps
Bartender
Posts: 2628
17
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Jan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!