File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem related to timestamp

 
Anand Loni
Ranch Hand
Posts: 150
  • 0
  • 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: 2575
11
C++ Linux Netbeans IDE
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic